[8] | 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 |
|
---|
[809] | 7 | %=======================================================================
|
---|
[1093] | 8 | % Copyright 2008-2021, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
|
---|
[809] | 9 | % http://www.legi.grenoble-inp.fr
|
---|
| 10 | % Joel.Sommeria - Joel.Sommeria (A) legi.cnrs.fr
|
---|
| 11 | %
|
---|
| 12 | % This file is part of the toolbox UVMAT.
|
---|
| 13 | %
|
---|
| 14 | % UVMAT is free software; you can redistribute it and/or modify
|
---|
| 15 | % it under the terms of the GNU General Public License as published
|
---|
| 16 | % by the Free Software Foundation; either version 2 of the license,
|
---|
| 17 | % or (at your option) any later version.
|
---|
| 18 | %
|
---|
| 19 | % UVMAT is distributed in the hope that it will be useful,
|
---|
| 20 | % but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 21 | % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 22 | % GNU General Public License (see LICENSE.txt) for more details.
|
---|
| 23 | %=======================================================================
|
---|
| 24 |
|
---|
[477] | 25 | function update_waitbar(hwaitbar,advance_ratio)
|
---|
[623] | 26 | if ishandle(hwaitbar)
|
---|
[339] | 27 | set(hwaitbar,'Units','pixels')
|
---|
[477] | 28 | pos=get(hwaitbar,'Position');%read waitbar position in pixels
|
---|
| 29 | set(hwaitbar,'Units','normalized')%set back to normalize(the waitbar scales with the GUI)
|
---|
[974] | 30 | % CData=ones(floor(pos(4)),floor(pos(3)),3);
|
---|
| 31 | % CData(:,:,3)=0 ;% initial color yellow (rgb=[1 1 0])
|
---|
| 32 | CData=zeros(floor(pos(4)),floor(pos(3)),3);
|
---|
| 33 | CData(:,:,3)=1 ;% initial color blue(rgb=[1 1 0])
|
---|
| 34 |
|
---|
[477] | 35 | CData(:,1:floor(advance_ratio*size(CData,2)),2)=0; % advancement part in red (suppress the second color component green)
|
---|
[339] | 36 | set(hwaitbar,'CData',CData)
|
---|
[623] | 37 | drawnow
|
---|
[809] | 38 | end
|
---|