×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Matlab Gui builder...

Matlab Gui builder...

Matlab Gui builder...

(OP)
I'm new to the GUI builder with the Matlab environment...

The question is very simple, as an examples...

If i use two edit text boxes to enter 2 variables...and a push button to execute a multiplication...

How do i display the result either in a edit text box or in a list box or any other way that will display a result on screen...

Quick reply would be appreciated...thanks

RE: Matlab Gui builder...

Hi,
It is very easy in the newer versions of Matlab. When you activate the GUI just answer YES to save the figure. The editor/debuger window will be opened with a prototype file. Down you will find headers for callbacks. Suppose you create 2 edit boxes , one text box (for the result) and a button. You have to fill in only acallback for the button. Under the header:
function varargout = pushbutton1_Callback(h, eventdata, handles, varargin)

Put the following lines:

A=get(handles.edit1,'string');
B=get(handles.edit2,'string');
if ~isempty(A) & ~isempty(B)
    C=num2str(str2num(A{:})*str2num(B{:}));
else
    C='?';
end
set(handles.text1,'string',C)

 Save the file, thats it.

Joe
BSTEX - Equation viewer for Matlab
http://www.geocities.com/bstex2001

RE: Matlab Gui builder...

(OP)
Thanks for the tip!!

But what if i want to display the result say...in an edit text box so that the user can see the result?

RE: Matlab Gui builder...

(OP)
forget it...i see my error!!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources