HilmiK
HilmiK

Reputation: 53

How to save plotted image in MATLAB?

Firstly, I am showing my image and put an hold on command to keep after operations.

figure,imshow(Ib_rgb)
hold on;

Then, I draw a line on that image.

plot([p1(2),p2(2)],[p1(1),p2(1)],'Color','r','LineWidth',2)

My question is, how to save this output image automatically ? Is there a way to name and save this image ?

There is a print function for it I guess, but I could not understand how to use in this situation easily ?

Thanks in advance.

Upvotes: 0

Views: 51

Answers (1)

Alper Kucukkomurler
Alper Kucukkomurler

Reputation: 1794

You can use saveas and use gcf to get the current figure:

saveas(gcf,'image.png');

Upvotes: 1

Related Questions