% CELLMIN - Find the minimum value in a cell array. Does not return its index.
% Works for up to 2D cell array
%
% minvalue = cellmin(a)

function minvalue = cellmin(a)
    
    arraysize = size(a);
    if length(arraysize)>2
        error('cellmin only works with up to 2D cell arrays');
    end
    
    minvalue = NaN;
    for i=1:arraysize(1)
        for j=1:arraysize(2)
            thisval = a{i,j};
            if size(thisval,2)==1
                thisval = thisval';
            end
            minvalue = min([minvalue thisval]);
        end
    end
    

    
