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 |
|
---|
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 |
---|
Note: See
TracBrowser
for help on using the repository browser.