The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Passing variable from a callback to a function
Replies: 1   Last Post: Jun 24, 2013 11:19 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 1
Registered: 6/20/13
Passing variable from a callback to a function
Posted: Jun 20, 2013 12:46 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I have a GUI which contains a pushbutton callback defined in it.

function pushbutton1_Callback(hObject, eventdata, handles)

% it calculates variables maxVal,maxInd,vect1,vect2,data1,lag
% and then it plots data1


% now it creates another pushbutton on the plot for another analysis which needs all the variables maxVal,maxInd,vect1,vect2,data1,lag

hb = uicontrol('Style', 'pushbutton', 'Tag','Push2','String', 'AVERAGE DATA',...
'Position', [445 470 100 40]);

% I have defined the function Average as a separate .m file. This is how I define the function

% Average.m

function [] = Average(maxVal,maxInd,vect1,vect2,data1,lag)
% here i use all the input arguments


% When I am trying to run the program, it shows ' Not enough input arguments.
Error while evaluating uicontrol Callback'

I guess I am not being able to pass the variable from the callback to the function. Can any1 plz help me with this ?

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.