given cell array 'cell1', create new cell array 'cell2' with elements of cell1 containing string 'f' and ages >=30 && <=40
Show older comments
cell1={'name' 'gender' 'age'; ...
's1' 'f' 25; ...
's2' 'm' 35; ...
's3' 'f' 30; ...
's4' 'm' 22; ...
's5' 'f' 38}
cell2={};
for the conditions given above, cell2 should be:
cell2={'s3' 'f' 30; ...
's5' 'f' 38}
How to I search through cell array cell1 and add rows to cell array cell2 containing string 'f' and ages >=30 && <=40?
I know how to cell2mat or cell2table and work with the matrix -- the problem is that the output should also be a cell array ... so I would like to avoid converting to a matrix or table.
Accepted Answer
More Answers (0)
Categories
Find more on Cell Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!