Creating a Cell to save n*n matrices
2 Comments
Since I didn't write the code I'm going to need a bit of help with your variable names. If I am interpreting what you're asking correctly then you want a 1x7 (or 7x1) cell array where the cells contain the nxn matrices of values you calculated in the inner loop?
To the best of my knowledge cells can contain any class of items, so you should be able to just define the cell contents as the matrix using indexing.
Peak_disp(num) = {Peak_mat}; % Parentheses around num indicates that we are
% defining the entirety of num element. Curly
% braces around Peak_mat defines the num element
% as a cell containing the Peak_mat matrix.
You shouldn't need to use 'index' or 'cc' in your indexing of Peak_disp, as these values are a fixed value from loops that have already ended.
On a side note, you can loop 'num' using num = 1:7. MATLAB defaults to increasing by 1 when no specific interval is defined.
Answers (0)
Categories
Find more on Multidimensional 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!