MATLAB: Problem with saving data as .mat file

save data mat file

Hi !
i have an output of a for loop. i want to save this output as .mat file.
how could i do this ?
I tried with save and fprintf but no results…
thank you for help

Best Answer

for K = 1 : 20
filename = sprintf('File_%03d.mat', K);
save(filename, 'K');
end