how do I create a loop for to extract doubles variables from a cell array?

3 views (last 30 days)
I have a cell array (10x1) that contain 10 [300x2000] double variables. I need to extract each double varables contained in each cell, rename it with the name "raster_data" and save each of them in a separate file.mat. This for loop allows me to generate a file.mat, but for achieve my final goal I should insert in each file.mat the variable "raster_data" .
Do you have any idea how I can complete the loop for?
for greater clarity I enclose also the data on which I have worked
thanks for any suggestion
for k = 1 : length(filename)
baseFileName = sprintf('%s.mat', filename{k});
fullMatFileName = fullfile(folder, baseFileName);
save(fullMatFileName, 'raster_labels');
end

Accepted Answer

Stephen23
Stephen23 on 20 Oct 2020
Edited: Stephen23 on 20 Oct 2020
Where raster_data is your cell array:
for k = 1:numel(filenames)
raster_labels = raster_data{k};
... the rest of your code
end

More Answers (0)

Categories

Find more on Loops and Conditional Statements 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!