Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
RE. Guide

Subject: RE. Guide

From: Vivek varadarajan

Date: 15 Nov, 2010 20:30:07

Message: 1 of 5

I created a simple GUI panel with text boxes for parameter entries and a button to run a computational routine.

My question is when the computational routine is called inside the button click call back function, I want to be able to access returned variables in the interpreter for plotting analysis.

for example. here is the outline of my GUI skeleton (not syntaxially written)

button_call_back()

output=routine(parameters extracted from text entries)

end

How do I access the variable "output" in the interpreter later on! Once the GUI quits after my routine returns I cannot seem to access the variable in the interpreter

Subject: RE. Guide

From: Sean de

Date: 15 Nov, 2010 22:40:08

Message: 2 of 5

"Vivek varadarajan" <v_varada@uncg.edu> wrote in message <ibs58e$6kq$1@fred.mathworks.com>...
> I created a simple GUI panel with text boxes for parameter entries and a button to run a computational routine.
>
> My question is when the computational routine is called inside the button click call back function, I want to be able to access returned variables in the interpreter for plotting analysis.
>
> for example. here is the outline of my GUI skeleton (not syntaxially written)
>
> button_call_back()
>
> output=routine(parameters extracted from text entries)
>
> end
>
> How do I access the variable "output" in the interpreter later on! Once the GUI quits after my routine returns I cannot seem to access the variable in the interpreter'

Hints:
doc setappdata
doc getappdata

Subject: RE. Guide

From: Vivek varadarajan

Date: 16 Nov, 2010 19:36:04

Message: 3 of 5

Here is my function from a button click callback and as you will see CSCmain is the name of my routine and it returns a variable "uv" , I want to be able to access uv in the workspace for post analysis

function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
epsilon=str2double(get(handles.epsbox,'String')) ;
zetas=str2double(get(handles.zetabox,'String')) ;
vr=str2double(get(handles.vrbox,'String')) ;
lam=str2double(get(handles.lambox,'String'));
T=str2double(get(handles.periodbox,'String'));
Amp=str2double(get(handles.amplitudebox,'String')) ;
dx=str2double(get(handles.dxbox,'String')) ;
dt=str2double(get(handles.dtbox,'String')) ;
CSCgui('visible','off')
close('CSCgui')
tic
[uv]=CSCmain(epsilon,zetas,lam,vr,Amp,T,dx,dt,15,6);
end
??

"Vivek varadarajan" <v_varada@uncg.edu> wrote in message <ibs58e$6kq$1@fred.mathworks.com>...
> I created a simple GUI panel with text boxes for parameter entries and a button to run a computational routine.
>
> My question is when the computational routine is called inside the button click call back function, I want to be able to access returned variables in the interpreter for plotting analysis.
>
> for example. here is the outline of my GUI skeleton (not syntaxially written)
>
> button_call_back()
>
> output=routine(parameters extracted from text entries)
>
> end
>
> How do I access the variable "output" in the interpreter later on! Once the GUI quits after my routine returns I cannot seem to access the variable in the interpreter

Subject: RE. Guide

From: ImageAnalyst

Date: 16 Nov, 2010 22:56:00

Message: 4 of 5

You made this nice GUI for your user, and then when you exit you're
going to force the user to interact with MATLAB command line functions
in the "interpreter" (command window)? Why do this to them? Just
handle everything in the GUI.

If you still insist on making it less convenient for your users, then
take a look at evalin() and assignin().

Subject: RE. Guide

From: Vivek varadarajan

Date: 17 Nov, 2010 02:22:04

Message: 5 of 5

Well I completely understand your reply, its the whole point of making a GUI,
but right now I am the only user and I wrote the GUI to make analysis for me easier faster and also to gain GUI programming experience along side.

So once again yes , my intention is once the GUI is exited as you mention rightly, I want to be able to access the variable output uv in the interpreter?
I will try evalin and asisignin

Thanks

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <4ea16389-fa96-43da-bb24-4c72e7de9dbc@s5g2000yqm.googlegroups.com>...
> You made this nice GUI for your user, and then when you exit you're
> going to force the user to interact with MATLAB command line functions
> in the "interpreter" (command window)? Why do this to them? Just
> handle everything in the GUI.
>
> If you still insist on making it less convenient for your users, then
> take a look at evalin() and assignin().

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us