How do I save multiple dynamically generated variables to the same .mat file?
Mostra commenti meno recenti
A dataset I'm working with makes my computer run out of ram when I try to process the entire thing at once, so I'm trying to process it once cell at a time and save that to a file to prevent a ram shortage. I think my problem is not understanding the proper syntax of the save() function in regards to dynamically generated variable names. The cut down code is below:
for x = 1 : rowLim
for y = 1 :colLim
param(x,y,:) = S1_PParam(C11(x, y), C22(x, y), C12_real(x, y), C12_imag(x, y));
save([path '\output.mat'], 'param(x,y,:)', '-append');
end
end
where rowLim and colLim denote the size of the file I'm working with, and S1_PParam is a custom function that returns a 1 by 1 by 27 array when called with the input parameters shown. I'm currently getting a "param(x,y,:)' is not a valid variable name" error, but I have no idea what the correct variable name would be in this case.
The ideal output would be a single variable in the .mat file that encompasses the entire dataset (e.g. a variable that is a rowLim by colLim by 27 array), but given that seems impossible given how the save() function works I'm just trying to get the output to be a .mat file containing separate 1 by 1 by 27 arrays for each cell in the dataset.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Workspace Variables and MAT Files in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!