0
votes

I have two cell arrays one named filenames, which is a 1x430 array containing a string of filenames e.g. the first and second cell are "Jan 1st 2016", "Jan 2nd 2016"... of several excel sheets of data.

The second cell array, max_vel, is a 1x430 array containing doubles that correspond respectively with these dates e.g. the first cell in max_vel contains data from Jan 1st 2016.

Is it possible to write a code that will save each cell of the cell array max_vel such that it corresponds to the name associated with the cell array filename as an input file?

My expected output would be that every double in the 1x430 cell array, max_vel, is saved as an individual input file with their associated filename. E.g. max_vel{1,1} is saved as Jan 1st 2016.inp, max_vel{1,2} is saved as Jan 2nd 2016.inp, etc.

Thanks!

1

1 Answers

2
votes

You can do this with just a for loop.

for k = 1:numel(max_vel)
    data = max_vel{k};
    filename = sprintf('%s.inp', filenames{k});
    save(filename, 'data');
end