How to get a collective output of multiple loop run using a selection condition in Matlab?

43 Views Asked by At

I have a table (L-arrival) of 279 rows and 252 columns. Only the first column has values while others are just NaN. The cells in the first column have multiple values (i.e. some have 1, some have 4 number of values). First of all, I am trying to select a single maximum value from each cell of the first column so that I can have a column of a single value for each cell only. Then I want to do this in a loop so that for every new value that I get, they are sorted and only the maximum values are chosen. Finally, I want to make a collection of these values obtained from multiple runs for each cell. Can anyone suggest to me how it can be approached in MatLab?I tried using the following code but didn't work well.

for b=1:279
        m = numel(cell2mat(L_arrival(b,1)));
        g(b)=mat2cell([cell2mat(g(b)); cell(L_arrival(b,1))]',[1 2]); 
    end
0

There are 0 best solutions below