how to save the image obtained from the plot command?

i have used the command "plot( cytoplasm1(:,2), cytoplasm1(:,1), 'g-', 'LineWidth', 1)" in my code. i don't know how to save the image that i am getting from this command into the folder... plz help me.....

추가 답변 (1개)

Stephen23
Stephen23 2014년 10월 10일
편집: Stephen23 2014년 10월 10일

0 개 추천

If you want a raster or vector file, then have look at the figure exporting command saveas.
If you want to save it as a MATLAB .fig, then use savefig.

댓글 수: 6

sou
sou 2014년 10월 10일
i couldn't know how to implement this command sir? whether i should assign a variable p to this command or not ? for example p=plot( cytoplasm1(:,2), cytoplasm1(:,1), 'g-', 'LineWidth', 1);
Stephen23
Stephen23 2014년 10월 10일
편집: Stephen23 2014년 10월 10일
Try this:
plot( cytoplasm1(:,2), cytoplasm1(:,1), 'g-', 'LineWidth', 1);
saveas(gcf,'my_wonderful_cytoplasm_image.png')
sou
sou 2014년 10월 11일
thanks sir... but i wanted to save that image in a folder....
It is saved in a folder: your current folder . If you want to put it in a subfolder of the current directory, you can use:
saveas(gcf,'my_subfolder\my_wonderful_cytoplasm_image.png')
I would not use the cd function. I'd use fullfile() as per the FAQ.
fullFileName = fullfile(folder, baseFileName);
Stephen23
Stephen23 2014년 10월 13일
편집: Stephen23 2014년 10월 13일
Sure. I was not trying to imply that they should change the Current Folder for just that one operation, but I have noticed that some users do not seem to realize that the Current Folder can be changed at all, yet their work would be much simpler if they simply changed to a more convenient directory.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 File Operations에 대해 자세히 알아보기

태그

질문:

sou
2014년 10월 10일

편집:

2014년 10월 13일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by