How to Loop on Different SNR values in MATLAB
Show older comments
Hi, I Hope you are doing well,
I want to make a Loop which takes different SNR value from array or cell. and save the mat file for each SNR
How can i do that?
i have the following code
But the files are overwritting How can i avoid overwrite
for SNR=[-20,-10,0,10,20,30]
channel = helperModClassTestChannel(...
'SampleRate', fs, ...
'SNR', SNR, ...
'PathDelays', [0 1.8 3.4] / fs, ...
'AveragePathGains', [0 -2 -10], ...
'KFactor', 4, ...
'MaximumDopplerShift', 4, ...
'MaximumClockOffset', 5, ...
'CenterFrequency', 902e6)
for p=1:numFramesPerModType
% Remove transients from the beginning, trim to size, and normalize
frame = helperModClassFrameGenerator(rxSamples, spf, spf, transDelay, sps);
% Save data file
fileName = fullfile(dataDirectory,...
sprintf("%s%s%s%03d_SNR",fileNameRoot,modulationTypes(modType),p,SNR));
save(fileName,"frame","label")
Accepted Answer
More Answers (0)
Categories
Find more on Logical 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!