How to "Pretty( )" output in GUI?

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

What was the solution to this query, because I have the same problem

Sign in to comment.

 Accepted Answer

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

Sir but why this
b=get(handles.inputfun,'string');
c=int(sym(b));
set(handles.answer,'string',pretty(c))
doesn't makes output to be in the form of
Pretty(----)
why I get this error
Error using sym.pretty
Too many output arguments.
Error in derivator>btndiff_Callback (line 130)
set(handles.answer,'string',pretty(c))
Error in gui_mainfcn (line 96)
feval(varargin{:});
Error in derivator (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)derivator('btndiff_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
Please help if its possible.
Try
outstr = evalc('pretty(c)');
like this Sir?
b=get(handles.inputfun,'string');
c=int(sym(b));
set(handles.answer,'string',char(c))
outstr = evalc('pretty(c)');
b=get(handles.inputfun,'string');
c=int(sym(b));
outstr = evalc('pretty(c)');
set(handles.answer,'string',outstr)
Albert  Shesman
Albert Shesman on 29 Jan 2014
Edited: Albert Shesman on 29 Jan 2014
Thaaaaaaaaaaaaaaaaaaaannkuuu Soooooooooooooooooo Much sirrrrr Really People here are very helpful :) Thank You Again Sir GOD BLESS YOUUUUUUUU..

Sign in to comment.

More Answers (3)

Image Analyst
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

I don't know what you consider the "output" to be, but if it's not your code and it's some measurements that you want to write to a file, you can use fprintf() to make it look just like you want it.
Sir its not "Petty()" its "Pretty()" I have Matlab R2013a Version, may be there's some difference because we're using different versions.
Sorry, I knew that - just a typo. Anyway, I don't have it so it must be in a toolbox that you have (and should list above in the Products section) that I don't have.
oh yes am sorry for that, it's related to 'symbolic mathtoolbox'
You still didn't list it in the Products section, so I did it for you.
oops sorry :p.. and thaaannkuu to you tooo thanku sir :)

Sign in to comment.

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)');
Abdul Goffar
Abdul Goffar on 10 Dec 2014
sorry... I was just solved it.. Thx so much :))

Tags

Community Treasure Hunt

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

Start Hunting!