How to "Pretty( )" output in GUI?
20 views (last 30 days)
Show older comments
Albert Shesman
on 22 Jan 2014
Commented: Walter Roberson
on 24 Sep 2016
Hello all, I am working on my assignment and I have created a GUI in Matlab one part of which takes user input (tag:inputfun) and integrates it and its working perfectly but I want that output to be as we write on paper i.e. in the form of "Pretty( )" so that user can easily understand. I tried a lot but I was unable to do that. Can anyone please help me so that I can submit my assignment as soon as possible. Hoping for Answer :)
2 Comments
Walter Roberson
on 24 Sep 2016
william taipe, see the solution below at http://www.mathworks.com/matlabcentral/answers/113328-how-to-pretty-output-in-gui#comment_192935
Accepted Answer
Walter Roberson
on 22 Jan 2014
outstr = evalc(pretty(c));
Remember to make handles.answers something that is fixed-width font (not proportional.) If it is a uicontrol 'text' or 'edit' box, make sure that its Max property is set to at least 2.
You might also need to use
outstrcell = regexp( outstr, '\n', 'split' );
and use that as your String
5 Comments
Walter Roberson
on 28 Jan 2014
Edited: Walter Roberson
on 28 Jan 2014
b=get(handles.inputfun,'string');
c=int(sym(b));
outstr = evalc('pretty(c)');
set(handles.answer,'string',outstr)
More Answers (3)
Image Analyst
on 22 Jan 2014
I never heard of Petty(), but you can click anywhere in the editor window and type control-a followed by control-i to fix the indenting. If you highlight a section of code, it will fix up that highlighted section only.
6 Comments
Abdul Goffar
on 10 Dec 2014
I got same trouble with you, but its't not solved yet. This is the error messages I got. Could you please help me fix it?
??? Error using ==> evalc
Undefined function or method 'pretty' for input arguments of type 'char'.
Error in ==> contoh>pushbutton3_Callback at 129
outstr=evalc('pretty(y)');
0 Comments
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!