Create multiple cell arrays that loop for each set of data?

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

Undoubtedly it is, but give us a concrete example to wrap heads around what the words are trying to describe...
I have a for loop that reads through multiple sheets of an excel with for and conditional statements to find certain variables from the data. Everytime I loop through a different sheet I want to create a new cell array that prints out the data that meet my conditions onto the corresponding sheet.
@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.
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.

Sign in to comment.

Answers (1)

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

Asked:

on 6 Oct 2022

Answered:

on 7 Oct 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!