Question
Hi everyone, can amyone please help on the following : I have a folder contains mualiple matfiles C1,C2,C3,C4.....C20. 1- I want to load all these files using for loop . All the files has the same matrix name (data) .. Then i want to claculate the absolute FFT for every single subject as follow: Y= abs(fft(data)); 2- i want to save the result of file 1 with Y1, and file 2 with Y2 and so on till C20 named with Y20. is there any way I can do it? Any help will be highly apperciated .
Expert Answer
Kshitij Singh
PhD Expert
Answered Aug 25, 2026
Try something like this:
N = 20;
D = 'path to the folder where the files are saved';
for k = 1:N
F = fullfile(D,sprintf('C%d.mat',k));
S = load(F);
Y = abs(fft(S.data));
F = fullfile(D,sprintf('Y%d.mat',k));
save(F,'Y')
end
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related matlab Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →