How to add and save struct in multiple .matfile for loop ?
Show older comments
HI, I have one folder name studygroup and a list of 26 .mat file in that folder. Each mat file contains 55 structure. I would like to add one struct (Struct.status = 'yes') for each .matfile using for loop, Is it possible?
directory{1,1} = 'studygroup'
files = dir(sprintf('%s/*.mat',directory{1,1})); % list all the .mat files. (26 .matfile )
for i=1:length(files)
load(sprintf('%s/%s',directory{1,1}, files(i).name));
Struct.status = 'yes';
save ('files', 'Struct')
end
what is the best way to add and save struct in multiple matfile ?
thank you
Accepted Answer
More Answers (0)
Categories
Find more on Workspace Variables and MAT Files 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!