MATLAB: Saving data from the command window

saving data from the command window

Hi All,
I have a matlab code, where I need to save the data (as a txt file) at the end. I can save it in a file in the editor itself. Is there any way that I can save the data from the command window? I mean, once run the code, I will asked to save it or not, if say yes, then it will ask me to give a name and then save it.
I appreciate for your help. Graig.

Best Answer

Do you have the data stored in a matrix at the time you would be asking about saving, or is the data to be stored "whatever happened to get written to the command window" including by routines that you have no control over?
If you need to save "whatever appeared in the command window" then you should consider creative use of "diary".
If you have all of the data, then it becomes a matter of using questdlg() and uiputfile()
Related Question