I have a cell array called output. Each cell within output contains a 1024 x 1024 matrix. I would like to threshold each matrix so that elements below a given value are set to NaN.
I tried using:
output(output < 100000) = NaN;
However, I feel that this is the wrong approach. Intuitively, I want to use a for loop, however, I don't think that will be the most efficient method possible.
Thoughts? Suggestions?
Thanks :)
it can be done with
cellfun
function!cell fun can implement a function on every cell (it's like for loop) Assume below examplefirst consider you have a variable named
a
in cell form.in this cell i want to substitute entries with
NaN
if entry lower than 3So I write below function for this purpose
the output will be like below