Clear Filters
Clear Filters

saving in different folders

3 views (last 30 days)
Indrani
Indrani on 19 Jun 2023
Answered: Ayush Kashyap on 19 Jun 2023
Hi
This is a statement in a for loop
[f_estimate(i), freqconf(i), z_estimate(i), dampconf(i)]
How do I save each of the variables in different folders?

Accepted Answer

Angelo Yeo
Angelo Yeo on 19 Jun 2023
save(fullfile(basepath, 'folder1', 'f_estimate.mat'), 'f_estimate')
save(fullfile(basepath, 'folder2', 'freqconf.mat'), 'freqconf')
% etc ...

More Answers (1)

Ayush Kashyap
Ayush Kashyap on 19 Jun 2023
Hi Indrani,
As per my knowledge, you can utilize the "save" and "fullfile" functions provided by matlab inside your for loop as follows:
save(fullfile(<folder path>, ['f_estimate_' num2str(i) '.mat']), 'f_estimate', '-v7.3');
You can also refer to this documentation for more details: Matlab Save Function

Categories

Find more on Variables in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!