I have a cellmatrix that I want to parse for specific rows in MATLAB. My own solution is pretty bad (see below), so I thought that someone could give me a hint on how to improve it. I'm sure I just need to somehow change the array of cells, but I'm not too sure how to do it.
I have one cell with elements of a logical array:
TheCell{with N-rows cell}(Logical Array with varying length, but max 24 entries)
For example:
TheCell{1} = [0,1,0,1,0,0,0,0,0,1,0]
TheCell{2} = [0,0,0,0]
...
TheCell{9} = [0,1,0,0,0,0,0]
In addition, I have one matrix called “Problem” that tells me which lines in “TheCell” interest me (the problem matrix stores some specific TheCell line indexes):
Problem(with M-rows)
For example:
Problem = [3,5,9]
() TheCell, "1" :
Critical = [1;2;3;4;5;6]
, , (3), .. TheCell {9} Critical (2), :
TheCell{Problem(3)}(Critical(2)) == 1
, :
Solution(counter) = Problem(3)
, , .
Critical = [1;2;3;4;5;6];
Solution = [];
counter = 1;
for i = 1:length(Problem)
Row = Problem(i);
b = length(TheCell{Row})
for k = 1:length(Critical)
if k > b
break;
end
if TheCell{Row}(Critical(k))==1
Solution(counter) = Row;
counter = counter+1;
break;
end
end
end