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') end end %Function for starting the main program function [] = start_call(varargin) MainProgram
ANSWER
Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.
Statisticalbeginner - rather than using a slider to record your progress, consider using an axes object which you would then draw an image representing the progress completed. For example, your GUI may have an axes for plotting something, a push button to kick-off the processing, and another axes to record progress. If you give your GUI a unique Tag (see the properties inspector for your GUI) and set its HandleVisibility property to on, then your main program can look for this GUI and update the axes that has been designated as the wait (or progress) bar.
function updateWaitBar
% find the GUI whose tag is GuiWaitBarExample (GUI HandleVisibility
% property must be set to on)
hGui = findobj('Tag','GuiWaitBarExample');
if ~isempty(hGui)
% get the GUI handles structure
handles = guidata(hGui);
% axes2 is the waitbar
if ~isempty(handles) && isfield(handles,'axes2')
% if the waitBarImg doesn't exist, then create it and the
% image graphics object
if ~isfield(handles,'waitBarImg')
handles.waitBarImg = uint8(ones(1,maxIters,3)*255);
handles.hWaitBarImg = image(handles.waitBarImg,'Parent',handles.axes2);
end
% reset to a white background
if k == 1
handles.waitBarImg(:,:,:) = 255;
end
SEE COMPLETE ANSWER CLICK THE LINK
Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.
Statisticalbeginner - rather than using a slider to record your progress, consider using an axes object which you would then draw an image representing the progress completed. For example, your GUI may have an axes for plotting something, a push button to kick-off the processing, and another axes to record progress. If you give your GUI a unique Tag (see the properties inspector for your GUI) and set its HandleVisibility property to on, then your main program can look for this GUI and update the axes that has been designated as the wait (or progress) bar.
function updateWaitBar % find the GUI whose tag is GuiWaitBarExample (GUI HandleVisibility % property must be set to on) hGui = findobj('Tag','GuiWaitBarExample'); if ~isempty(hGui) % get the GUI handles structure handles = guidata(hGui); % axes2 is the waitbar if ~isempty(handles) && isfield(handles,'axes2') % if the waitBarImg doesn't exist, then create it and the % image graphics object if ~isfield(handles,'waitBarImg') handles.waitBarImg = uint8(ones(1,maxIters,3)*255); handles.hWaitBarImg = image(handles.waitBarImg,'Parent',handles.axes2); end % reset to a white background if k == 1 handles.waitBarImg(:,:,:) = 255; end
Comments
Post a Comment