Create multiple cell arrays that loop for each set of data?
Show older comments
I have for loops that take multiple sets of data and runs them through conditional statements, I want to output the results to a cell array for each data set. Is it possible to loop a cell array output for each result after the conditions and saving the results to the workplace?
4 Comments
dpb
on 6 Oct 2022
Undoubtedly it is, but give us a concrete example to wrap heads around what the words are trying to describe...
Jaime Santos
on 7 Oct 2022
Jan
on 7 Oct 2022
@Jaime Santos: Please post the relevant part of the code instead of telling a story about what the code should do. It is much easier to suggest a matching line of code, than to explain, what might be useful.
dpb
on 7 Oct 2022
Or, if you don't have code, attach some sample data that illustrates what you're after -- and post the actual data itself, not an image of it; nothing can be done with images other than look; no more helpful fhan verbal generic descriptions.
Answers (1)
Walter Roberson
on 7 Oct 2022
0 votes
Yes, it is possible, but we recommend against it.
Please read http://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically-eval for information about why we strongly recommend against creating variable names dynamically.
Creating a new cell array for each different sheet would involve creating variable names dynamically.
Creating a new entry in a cell array would be fine.
Categories
Find more on Loops and Conditional Statements 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!