MATLAB Answers

0

how to save file by m-file?

Asked by Mohammad Fisal Rabin on 18 Jan 2019
Latest activity Answered by 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

  0 Comments

Sign in to comment.

1 Answer

Answer by 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 .

  0 Comments

Sign in to comment.