source: trunk/src/update_waitbar.m @ 872

Last change on this file since 872 was 809, checked in by g7moreau, 10 years ago
  • Add license
File size: 1.7 KB
RevLine 
[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%=======================================================================
8% Copyright 2008-2014, LEGI UMR 5519 / CNRS UJF G-INP, Grenoble, France
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]25function update_waitbar(hwaitbar,advance_ratio)
[623]26if ishandle(hwaitbar)
[339]27set(hwaitbar,'Units','pixels')
[477]28pos=get(hwaitbar,'Position');%read waitbar position in pixels
29set(hwaitbar,'Units','normalized')%set back to normalize(the waitbar scales with the GUI)
30CData=ones(floor(pos(4)),floor(pos(3)),3);
31CData(:,:,3)=0 ;% initial color yellow (rgb=[1 1 0])
32CData(:,1:floor(advance_ratio*size(CData,2)),2)=0; % advancement part in red (suppress the second color component green)
[339]33set(hwaitbar,'CData',CData)
[623]34drawnow
[809]35end
Note: See TracBrowser for help on using the repository browser.