how I can automatically save the output of a for loop?

3 views (last 30 days)
I created a loop that performs operations on a series of 2D matrices, each cycle I want to save the output matrix, so I need a way to automatically save these matrices creating an automatic generation of file names
  3 Comments
Francesca Di Nicola
Francesca Di Nicola on 8 Mar 2015
I created a Cell Arrays (1x200), now, how can I save the numerical matrix?

Sign in to comment.

Answers (1)

Star Strider
Star Strider on 8 Mar 2015
Edited: Star Strider on 8 Mar 2015
If you’re creating a series of 2D matrices, I would concatenate them into a single resultant 3D matrix (use something like: Savemat=cat(3, Savemat, Mat); then save the updated ‘Savemat’ in the same .mat file at each iteration, or preferably after the loop.
That way, you have all your 2D matrices in one 3D matrix that you can load from one file and easily address in your code.
  6 Comments
Francesca Di Nicola
Francesca Di Nicola on 8 Mar 2015
Edited: Francesca Di Nicola on 8 Mar 2015
I have 16 data series, each series has 9000 file.mat, each file.mat contains a matrix (480x640) with temperature data. This matrix in all the files is called Frame. I need to: create a matrix that will call COND, cutting Frame to delete the data that are not needed, the difference with the T reference and then divide by a costane. create a matrix that will call CONV containing the media space of the Frame and then make a difference with the T reference make the product element by element between CONV and COND
this for each file.mat obviously I need to implement an automated way
Star Strider
Star Strider on 8 Mar 2015
This seems quite distant from your original Question here.
Create a new Question that describes in some detail what you really want to do, expanding on your last Comment. It seems like a much more complicated project than I want to deal with.
Write the code to implement it yourself. If you have problems with your code, post the relevant parts of it along with a description of what you want your code to do and what it is doing, including the entire red text of any error messages that your code throws.
We will then help you get it to run.
I will delete my Answer — including this Comment — in a few hours, since it does not address your actual problem.

Sign in to comment.

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!