MATLAB Answers

How to save the hold on image

13 views (last 30 days)
HUANG YU-CHE
HUANG YU-CHE on 5 Jul 2020 at 9:04
Commented: HUANG YU-CHE on 7 Jul 2020 at 4:56
So I two figures, one is the background and one is the plot line. How can I save them all in one figure?
imshow(averaged_bw1);hold on
plot(interp1((1:n)',re,(1:n)','pchip'),rowx, 'b-', 'LineWidth', 2);
recDir = fullfile('C:\','Users','User','Documents','MATLAB',cas,strrep('carmeri','i',int2str(num_carmer))...
,strrep('linetracki','i',int2str(num_photo)));
mkdir(recDir);
imwrite
(averaged_bw1,re,[recDir,'\',strrep('linet','t',num2str(numt)),'.png']);%what code should I write in this part
I'm going to save the figure like this

  0 Comments

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 5 Jul 2020 at 15:16
Try exportgraphics() if you have R2020a. Otherwise use export_fig().

  1 Comment

Sign in to comment.

More Answers (1)

dipak nigam
dipak nigam on 5 Jul 2020 at 11:16
Hey, I think you need to use the 'imwrite' command instead of 'imwrit'.
If it is a typo, you can refer to this answer to save the image at your desired directory with the name you want.
Please go through imwrite documentation as well

  4 Comments

Show 1 older comment
HUANG YU-CHE
HUANG YU-CHE on 5 Jul 2020 at 11:38
what's I mean is that i have a background image and i had used hold on to see if the line i what if it correct,and i what to save every image to check if there are something wrong ,so i 'm thinking if i can save two thing
together,thanks
Image Analyst
Image Analyst on 5 Jul 2020 at 15:16
imwrite() won't work unless the blue has been burned into an RGB image.

Sign in to comment.


Translated by