I have a 1x10 ( say 10 because it is actually 262144, but for the purpose of my question, 10 is enough) cell array called x. Each cell is an array of 0 to 4 real values.
I'd like to run an if condition based on the number of element in each cell, WITHOUT using a for loop (as I said, it is actually 262144 cell long, so a for loop might be a bit heavy).
for loop exemple to show what I want to do :
for i = 1:10
if numel(x{i}) > 2
h(i) = 0;
else
h(i) = 1;
end
end
And then I'll want to run a while loop independantly on each cell, incrementing h by 1 until it reaches the value of the lenght of the cell.
len = cellfun(@numel,x)
while h < len
h = h+1;
%code that does thing on each cell still in the while loop
end
I've never seen anything like that online even though I've looked quite thoroughly. If anyone can give me a global indication on how to work independantly on separate cells without using a for loop (which is the core of my problem), I'd be great!
EDIT : Knowing how to operate on value X of all cells would be great too. E.g:
k = x{:}(1) < x{:}(2)
This doesn't work, but I don't know why and I don't what would. Trying to compare all first values with all second values.