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

4 visualizaciones (últimos 30 días)
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

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by