Adding row to matrix in a loop
Show older comments
I have a folder with many files (file_1, file_2 ... file_n), each of them contains variables (A, B, C ...). I need to work with several files (number of files varies) that I specifically choose from the folder (eg. file_1, file_7, file_22, ... file_m) - load the file, calculate some stuff and save the result as a new row to a matrix and then do this for another file etc.
I ´ve been thinking of using for loop to load and calculate, but I can´t figure out how to add a new row to a matrix after every loop. I tried "cat", but it didn´t work the way I need. Or is there a better solution?
And furthemore I need to plot the results in one graph the way I can specify the plot details for a group of files (eg. plot the first 10 results in red, the next ones in green, etc.). I can´t do it manually, because there are dozens of files.
Thanks in advance!
Accepted Answer
More Answers (0)
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!