Pushbutton to save or print content of an handles

조회 수: 1 (최근 30일)
Jethro
Jethro 2012년 1월 15일
Hi everybody! Anyone knows how to set a print/save button?? I inserted an Edit Text space (Enabled as inactive) to use it like a display to show results of my statistics... I'd like to set pushbuttons to print or save in a file the results I see in that space... It's possible?? How can I do it??
EDIT 1:
Image Analyst and Chandra advised me to use fprintf to "save" my statistics, and what if I wanted to save or print a chart?? There're any possibilities??

채택된 답변

Image Analyst
Image Analyst 2012년 1월 15일
You can use GUIDE to make a GUI. In the callback for your pushbutton, put the code to save whatever you want to save. It might be calling save() to save variables to a proprietary format MAT file, it could use fwrite() to write a binary file, fprintf() to write a text file, csvwrite() or clmwrite(), imwrite() to write an image, or export_fig to save a screenshot. If you just want to save some text you sent to an edit field then I'd probably use fprintf() to write it out to a regular flat text file.
  댓글 수: 2
Jethro
Jethro 2012년 1월 15일
Yes, I didn't think about fprinf... Anything about how to open the std print interface??
Image Analyst
Image Analyst 2012년 1월 15일
Regarding your question below about how to save graphs, etc., use export_fig, as mentioned in the FAQ http://matlab.wikia.com/wiki/FAQ#How_do_I_save_my_figure.2C_axes.2C_or_image.3F_I.27m_having_trouble_with_the_built_in_MATLAB_functions. and on the front page of the File Exchange (because it's the most frequently downloaded file). And regarding fprintf(), there are examples in the help, either for fprintf() or fopen().

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by