How do you append data to a 5-D double variable in a matfile? I'm trying to update a data file that I have that is saved as a .mat file, and am easily able to append simple variables, but am not sure how to append 4-D and 5-D variables

I have all the data for the different dimensions of the variable, but am unsure how to "stitch" them all together and save as a single "datapoint" for the variable. If anyone can point me to a reference or example with which a 4D or 5D variable is appended with new data, I'd be really really grateful. I would be compiling all the data initially through Excel and then trying to append them to a .mat file. Thanks very much in advance.

답변 (1개)

out = rand(3,3) ;
filename='myfile.mat';
save(filename,'out'); % Write to MAT file
%%Append 4D matrix
M4 = rand(4,4,10) ;
save(filename,'M4','-append');
%%Append 5D matrix
M5 = rand(10,10,5) ;
save(filename,'M5','-append');

댓글 수: 2

Thanks very much for this. I was actually curious as to how to append new datapoints to existing 4-d or 5-d variables in the .mat file, so in this case, who would I be able to append data to the M5 variable? I believe using the "-append" overwrites the existing variable in the file?
In that case, read M5 add the new matrices to it and append it.

댓글을 달려면 로그인하십시오.

카테고리

질문:

2016년 10월 3일

댓글:

2016년 10월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by