push botton
Show older comments
Hi,
I am writing a script and at some point i need to repeat the execution of a part of script. So i want to add a pus button in the process and the goal is when the user click the push button, that particular code should execute and do some calculations.
So wanna do something like following:
pb1 = uicontrol(figure1,'Style','pushbutton','String','Update',...
'Position',[40, 80, 120, 40]);
% Everytime user press "Update"
load('someMatFile','variable1');
plot(variable1);
so on and so forth
I am not using any function in the script so when i try to use callback function for push button, i get some error messages.
Thanks for your help in advance.
\\Arsalan
Accepted Answer
More Answers (1)
Matt Fig
on 25 Mar 2011
1 vote
You will either need to put the function in a separate M-file, or convert the script itself to a function so that the callback function is a subfunction.
Categories
Find more on Interactive Control and Callbacks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!