source: trunk/src/update_waitbar.m @ 1155

Last change on this file since 1155 was 1127, checked in by g7moreau, 11 months ago

Update Joel email

File size: 1.8 KB
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%=======================================================================
8% Copyright 2008-2024, LEGI UMR 5519 / CNRS UGA G-INP, Grenoble, France
9%   http://www.legi.grenoble-inp.fr
10%   Joel.Sommeria - Joel.Sommeria (A) univ-grenoble-alpes.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
25function update_waitbar(hwaitbar,advance_ratio)
26if ishandle(hwaitbar)
27set(hwaitbar,'Units','pixels')
28pos=get(hwaitbar,'Position');%read waitbar position in pixels
29set(hwaitbar,'Units','normalized')%set back to normalize(the waitbar scales with the GUI)
30% CData=ones(floor(pos(4)),floor(pos(3)),3);
31% CData(:,:,3)=0 ;% initial color yellow (rgb=[1 1 0])
32CData=zeros(floor(pos(4)),floor(pos(3)),3);
33CData(:,:,3)=1 ;% initial color blue(rgb=[1 1 0])
34
35CData(:,1:floor(advance_ratio*size(CData,2)),2)=0; % advancement part in red (suppress the second color component green)
36set(hwaitbar,'CData',CData)
37drawnow
38end
Note: See TracBrowser for help on using the repository browser.