I want to set NAN to these cells. Basically i wanted to do a basic threshold operation on a cell array of cell array of matrix . Some of the cells are empty cells, while others have values. If the absolute values in the cells are less than a threshold value say 5, i want to assign a zero to it. The problem is that the empty cells are also set to zero, which i do not want. So if we convert empty cell to NAN this problem can be solved. After the operation i can reassign NAN as an empty cell. But I am not able to perform this operation. I am able to do it in the first level based on previous discussion in the forum. for eg:
c={[] [] [2 4 5] [] [2 3 4 6 7]}% 1×5 cell array -- [] [] [1×3 double] [] [1×5 double]
fx=@(x)any(isempty(x))ind=cellfun(fx,c)c(ind)={nan}
I get
c = 1×5 cell array [NaN] [NaN] [1×3 double] [NaN] [1×5 double]
Now for this example how can i do the same process?
c={{[] [1 2]} { [] [] [2 4 5]} {[] [2 3 4 6 7] []}}c = 1×3 cell array {1×2 cell} {1×3 cell} {1×3 cell}
When i follow the previous step I am getting the error "Function 'subsindex' is not defined for values of class 'cell'."
Best Answer