I have a UIcontrol program like below
function [] = MyGui()S.fh = figure('units','pixels',... 'position',[200 200 800 800],... 'menubar','none',... 'name','GUI_2',... 'numbertitle','off',... 'resize','off');S.ls = uicontrol('Style','text',... 'String','INTERACTIVE PARAMETER UPDATE',... 'FontWeight','bold',... 'FontSize', 12,... 'position',[200 700,400,50]); S.pb1 = uicontrol('style','push',... 'units','pix',... 'position',[350 400 100 40],... 'fontsize',12,... 'string','Start',... 'callback',{@start_call});S.ed = uicontrol('style','edit',... 'unit','pix',... 'position',[220 300 100 40],... 'fontsize',12,... 'string','New String');S.pb2 = uicontrol('style','push',... 'units','pix',... 'position',[500 300 100 40],... 'fontsize',12,... 'string','Add String',... 'callback',{@update_call,S});%Function for getting the nTs value and passing into encdec
function [] = update_call(varargin)% Callback for pushbutton, reads new string from edit box.
S = varargin{3};addstr = str2double(get(S.ed,'string')); % The string to add to the stack.
if ~strcmp(addstr,'NaN') if addstr > 0 && addstr < 100 addstr %pass the value to encdec
else msgbox('Please enter a number between 1 and 100','WARNING') endend%Function for starting the main program
function [] = start_call(varargin)MainProgram
I am doing following tasks 1. I press the start and "MainProgram" runs. (Its a long running process) 2. I put some value in edit text box and press the update 3. The value will be passed onto the "MainProgram" for update.
Now I have two questions 1. there is a waitbar in MainProgram and how to merge that in main GUI (Instead of having a seperate pop-up). (start_call) 2. If user enters "addstr" value and press update, how can I interrupt MainProgram to take this addstr value for further processing ?
Thanks. 2.
Best Answer