Ignore:
Timestamp:
Jun 26, 2012, 8:40:09 AM (12 years ago)
Author:
sommeria
Message:

various bugs repaired.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/update_waitbar.m

    r339 r477  
    33%INPUT:
    44% hwaitbar:  handles of the waitbar to update
    5 % bar_size: vector with 4 elements, representing the abscissa, ordinate, width, height of the waitbar relative to the GUI 
    65% advance_ratio: number between 0 and 1 representing the advancement of the calculation (loop index relative to the total length)
    76
    8 function update_waitbar(hwaitbar,bar_size,advance_ratio)
    9 % waitbarpos(1)=bar_size(1);
    10 % waitbarpos(3)=bar_size(3);
    11 % waitbarpos(4)=advance_ratio*bar_size(4);
    12 % waitbarpos(2)=bar_size(4)+bar_size(2)-waitbarpos(4);
    13 % set(hwaitbar,'Position',waitbarpos)
     7function update_waitbar(hwaitbar,advance_ratio)
     8
    149set(hwaitbar,'Units','pixels')
    15 pos=get(hwaitbar,'Position');
    16 CData=zeros([floor(pos(4)) floor(pos(3)) 3]);
    17 set(hwaitbar,'Units','normalized')
    18 CData(:,1:floor(advance_ratio*size(CData,2)),1:2)=1;
     10pos=get(hwaitbar,'Position');%read waitbar position in pixels
     11set(hwaitbar,'Units','normalized')%set back to normalize(the waitbar scales with the GUI)
     12CData=ones(floor(pos(4)),floor(pos(3)),3);
     13CData(:,:,3)=0 ;% initial color yellow (rgb=[1 1 0])
     14CData(:,1:floor(advance_ratio*size(CData,2)),2)=0; % advancement part in red (suppress the second color component green)
    1915set(hwaitbar,'CData',CData)
    2016drawnow
Note: See TracChangeset for help on using the changeset viewer.