From: Walter Roberson on 2 Jun 2010 18:52 joseph Frank wrote: > SampleAll 478x221 array. it si a mix of nan,numbers and strings but > the third column is only numbers and nans Okay, that eliminates issues with nesting, but you did not clarify what output you are looking for. If you want a 478x221 array of logical, with (J,K) being true of SampleAll{J,K} contains a nan, then the cellfun with any(isnan(V)) will do. If you want the indices of where the nan are within SampleAll{J,K} then more work would be required.
From: joseph Frank on 2 Jun 2010 18:58 unfortunately I need the indices
From: Jan Simon on 3 Jun 2010 08:01
Dear Joseph! > unfortunately I need the indices Although I do love CELLFUN, especially for the very fast builtin commands, it might be a good idea to start with creating a simple double loop here: A = cell(m, n); <your data> [nm, nn] = size(A); for im = 1:nm for in = 1:nn NaNIndex = find(isnan(A{im, in})); <perform your operations on the NaN elements here> end end This might be slower or faster than the CELLFUN approach. It is not as nice as CELLFUN, but simple. Kind regards, Jan |