how to save file by m-file?

2 views (last 30 days)
Mohammad Fisal Rabin
Mohammad Fisal Rabin on 18 Jan 2019
Answered: Walter Roberson on 18 Jan 2019
hy, I have a code to save the .jpg file from the .mat file, but the code doesn't work. What do you suggest? Your help is appreciated. thanks
for i=1:150
img=F0S1belakang(:,:,1,i); %F0S1belakang is mat file (F0S1belakang.mat)
imsave(img);
end

Answers (1)

Walter Roberson
Walter Roberson on 18 Jan 2019
imsave can be called with no arguments to open a tool to save an image that is displayed in the current axes. imsave can also be passed the handle of aa specific primative chart image object .
imsave cannot be passed the data to be saved.
You have a few choices:
  1. you can display the data as an image inside the loop and call imsave
  2. you can call uiputfile to permit the user to select a file name each of the 150 times, passing the file name to imwrite
  3. you can use fullfile and sprintf or equivalent in order to mechanical build a file name at each iteration and inwrite to the file. Optionally call uigetdir once before the loop to permit the user to select the output directory .

Categories

Find more on Environment and Settings 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!