dd_m( all(cellfun(@isnan,dd_m ,'UniformOutput', false),2), : ) = [];
the answer is:
??? Undefined function or method 'all' for input arguments of type 'cell'.
Why?
Please help me
thank you
mfrab
You got me confused. How do you expect to remove things without reshaping?
Perhaps you can give a small example of the expected input and output?
A = {1 ; 2:10 ; repmat(3,3,3) ; NaN ; 5 ; 'text'} ; % a 6x1 cell with 1 NaN
% -> B = {...} ??
Jos
first matrix of the cell
1 2 3 4 5 6 7
NaN NaN Nan NaN NaN Nan
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
second matrix of the cell
NaN NaN Nan NaN NaN Nan
1 2 3 4 5 6 7
1 2 3 4 5 6 7
NaN NaN Nan NaN NaN Nan
1 2 3 4 5 6 7
and so on
I vant to remove rows that contains NaNs
i expect this result:
first matrix of the cell
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
second matrix of the cell
1 2 3 4 5 6 7
1 2 3 4 5 6 7
1 2 3 4 5 6 7
I wrote without reshaping because i tried to remove Nans and the result was an array not a matrix.
thank you for your attention
mfrab
First, reconsider your problem and the final solution. Is this problem just part of a larger problem, and do you really need to throw out rows in every cell to arrive at the final solution or can you take another route? The links between cells may become disrupted and it may, for instance, be wiser to store the contents of the 12 cells in different variables.
That being said, and assuming number of columns in each cell is the same, try this:
C = {[10 20 ; NaN NaN ; 11 12] ; [30 40 ; 31 41 ; NaN 42] ; [NaN NaN ; NaN NaN ; 52 62]}
D = cat(1,C{:})
q = ~all(isnan(D),2)
RES = mat2cell(D(q,:),sum(reshape(q,size(C{1},1),[])))
hth
Jos
"Jos " <#10...@fileexchange.com> wrote in message <gmui8c$d59$1...@fred.mathworks.com>...
You're welcome. In return, try to actually understand the code and not simply copy and paste it ;-)
Best,
Jos