Clear Filters
Clear Filters

How to save column values as Mat file in for Loop

2 views (last 30 days)
Hi all, i hope you are doing well
i have the code, the frameread has shape 1024x9999,
i want to save the 1024 value of every column in seprate mat file in MATLAB how can i do that
dataDirectory='C:\Users\DELL\Documents\MATLAB\Examples\R2021b\deeplearning_shared\ModulationClassification'
fileNameRoot = "frame";
for p=1:length(frameread)
% Remove transients from the beginning, trim to size, and normalize
frameread = helperModClassFrameGenerator(S, spf, spf, transDelay, sps);
% Save data file
fileName = fullfile(dataDirectory,...
sprintf("%s%s%03d",fileNameRoot,'MOD',p));
save(fileName,"frame")
end

Accepted Answer

Benjamin Thompson
Benjamin Thompson on 8 Feb 2022
Some possible changes are in bold text below. Hard to be sure without all the data and code.
dataDirectory='C:\Users\DELL\Documents\MATLAB\Examples\R2021b\deeplearning_shared\ModulationClassification'
fileNameRoot = "frame";
frameread = helperModClassFrameGenerator(S, spf, spf, transDelay, sps);
for p=1:size(frameread,2)
% Remove transients from the beginning, trim to size, and normalize
% Save data file
fileName = fullfile(dataDirectory,...
sprintf("%s%s%04d",fileNameRoot,'MOD',p));
save fileName frameread(:,p)
end

More Answers (0)

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!