Last change
on this file since 728 was
623,
checked in by sommeria, 12 years ago
|
waitbar system for series improved to aloow use as stand alone fcts.
to add at the head of series fcts:
hseries=findobj(allchild(0),'Tag','series');
RUNHandle=findobj(hseries,'Tag','RUN');%handle of RUN button in GUI series
WaitbarHandle?=findobj(hseries,'Tag','Waitbar');%handle of waitbar in GUI series
call to waitbar:
update_waitbar(WaitbarHandle?,index/nbfield)
if ishandle(RUNHandle) && ~strcmp(get(RUNHandle,'BusyAction?'),'queue')
disp('program stopped by user')
break
end
|
File size:
871 bytes
|
Line | |
---|
1 | %'update_waitbar': update the waitbar display, used for ACTION functions in the GUI 'series'
|
---|
2 | %------------------------------------------------------------------
|
---|
3 | %INPUT:
|
---|
4 | % hwaitbar: handles of the waitbar to update
|
---|
5 | % advance_ratio: number between 0 and 1 representing the advancement of the calculation (loop index relative to the total length)
|
---|
6 |
|
---|
7 | function update_waitbar(hwaitbar,advance_ratio)
|
---|
8 | if ishandle(hwaitbar)
|
---|
9 | set(hwaitbar,'Units','pixels')
|
---|
10 | pos=get(hwaitbar,'Position');%read waitbar position in pixels
|
---|
11 | set(hwaitbar,'Units','normalized')%set back to normalize(the waitbar scales with the GUI)
|
---|
12 | CData=ones(floor(pos(4)),floor(pos(3)),3);
|
---|
13 | CData(:,:,3)=0 ;% initial color yellow (rgb=[1 1 0])
|
---|
14 | CData(:,1:floor(advance_ratio*size(CData,2)),2)=0; % advancement part in red (suppress the second color component green)
|
---|
15 | set(hwaitbar,'CData',CData)
|
---|
16 | drawnow
|
---|
17 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.