Changeset 405 for trunk/src


Ignore:
Timestamp:
May 1, 2012, 10:08:36 PM (13 years ago)
Author:
sommeria
Message:

many bugs corrected: composition of 2 input fields, arrow colors from different scalar fields...

Location:
trunk/src
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/calc_field.m

    r404 r405  
    7777end
    7878FieldList=FieldList(check_calc==1);
    79 if isempty(FieldList)
    80     DataOut=DataIn;
    81     return
    82 end
     79% if isempty(FieldList)
     80%     DataOut=DataIn;
     81%     return
     82% end
    8383if isfield(DataIn,'Z')&& isequal(size(DataIn.Z),size(DataIn.X))
    8484    nbcoord=3;
     
    9393%% interpolation with new civ data
    9494if isfield(DataIn,'SubRange') && isfield(DataIn,'Coord_tps') && (exist('Coord_interp','var') || check_grid ||check_der)
    95     %create a default grid if needed
    96     if  ~exist('Coord_interp','var')
    97         coord_x=DataIn.XMin:DataIn.Mesh:DataIn.XMax;
    98         coord_y=DataIn.XMin:DataIn.Mesh:DataIn.YMax;
    99         [XI,YI]=meshgrid(coord_x,coord_y);
    100         XI=reshape(XI,[],1);
    101         YI=reshape(YI,[],1);
    102         Coord_interp=[XI YI];
    103     end
     95   
    10496    DataOut.ListGlobalAttribute=DataIn.ListGlobalAttribute; %reproduce global attribute
    10597    for ilist=1:numel(DataOut.ListGlobalAttribute)
     
    113105    XMin=min(min(DataIn.SubRange(1,:,:)));
    114106    YMin=min(min(DataIn.SubRange(2,:,:)));
    115 %     check_der=0;
    116 %     check_val=0;
     107    %create a default grid if needed
     108    if  ~exist('Coord_interp','var')
     109        if ~isfield(DataIn,'Mesh')
     110            DataIn.Mesh=sqrt(2*(XMax-XMin)*(YMax-YMin)/numel(DataIn.Coord_tps));
     111            % adjust the mesh to a value 1, 2 , 5 *10^n
     112            ord=10^(floor(log10(DataIn.Mesh)));%order of magnitude
     113            if DataIn.Mesh/ord>=5
     114                DataIn.Mesh=5*ord;
     115            elseif DataIn.Mesh/ord>=2
     116                DataIn.Mesh=2*ord;
     117            else
     118                DataIn.Mesh=ord;
     119            end
     120        end
     121        coord_x=XMin:DataIn.Mesh:XMax;
     122        coord_y=YMin:DataIn.Mesh:YMax;
     123        [XI,YI]=meshgrid(coord_x,coord_y);
     124        XI=reshape(XI,[],1);
     125        YI=reshape(YI,[],1);
     126        Coord_interp=[XI YI];
     127    end
    117128    nb_sites=size(Coord_interp,1);
    118129    nb_coord=size(Coord_interp,2);
     
    124135                DataOut.V=zeros(nb_sites,1);
    125136            otherwise
    126   %          case{'vort','div','strain'}% case of spatial derivatives
     137                %          case{'vort','div','strain'}% case of spatial derivatives
    127138                DataOut.(FieldList{ilist})=zeros(nb_sites,1);
    128 %                 otherwise % case of a scalar
    129 %                     check_val=1;
    130 %                     DataOut.(FieldList{ilist})=zeros(size(Coord_interp,1));
     139                %                 otherwise % case of a scalar
     140                %                     check_val=1;
     141                %                     DataOut.(FieldList{ilist})=zeros(size(Coord_interp,1));
    131142        end
    132143    end
     
    142153        %                 ctrs=DataIn.Coord_tps(1:nbvec_sub,:,isub);%(=initial points) ctrs
    143154        nbval(ind_sel)=nbval(ind_sel)+1;% records the number of values for eacn interpolation point (in case of subdomain overlap)
    144         if check_val
     155        if check_grid
    145156            EM = tps_eval(Coord_interp(ind_sel,:),DataIn.Coord_tps(1:nbvec_sub,:,isub));%kernels for calculating the velocity from tps 'sources'
    146157        end
     
    164175                    VarAttributes{1}.Role='scalar';
    165176                    DataOut.V(ind_sel)=DataOut.V(ind_sel)+EM *DataIn.V_tps(1:nbvec_sub+3,isub);
    166                 case 'norm_vel' 
     177                case 'norm_vel'
    167178                    ListFields={'norm_vel'};
    168179                    VarAttributes{1}.Role='scalar';
  • trunk/src/fileparts_uvmat.m

    r390 r405  
    115115    %r=regexp(FileName,'.*[^a^b^A^B](?<end_string>ab|AB|[abAB])\>','names');
    116116    NomType='';
    117     r=regexp(RootFile,'\D(?<num1>\d+)(?<end_string>[a-z]|[A-Z]|[a-z][a-z]|[A-Z][A-Z])$','names');
     117    r=regexp(RootFile,'\D*(?<num1>\d+)(?<end_string>[a-z]|[A-Z]|[a-z][a-z]|[A-Z][A-Z])$','names');
    118118    if ~isempty(r)
    119119        NomType=get_type(r.end_string);
  • trunk/src/plot_field.m

    r404 r405  
    880880            set(hima,'YData',AY);
    881881        end
     882        % set the transparency to 0.5 if vectors are also plotted
     883        if test_vec
     884            set(hima,'AlphaData',0.5)
     885        else
     886            set(hima,'AlphaData',1)
     887        end
    882888    end
    883889    test_ima=1;
  • trunk/src/read_field.m

    r404 r405  
    6464                    [Field,ParamOut.VelType,errormsg]=read_civdata(ObjectName,InputField,ParamIn.VelType,Data.CivStage);
    6565                    CivStage=Field.CivStage;
     66                    ParamOut.CivStage=Field.CivStage;
    6667                    %case of old civx conventions
    6768                elseif ~isempty(Data.absolut_time_T0)&& ~isequal(Data.civ,0)
  • trunk/src/set_col_vec.m

    r356 r405  
    1111% colcode: struture setting the colorcode for vectors
    1212            % colcode.CName: 'ima_cor','black','white',...
    13             % colcode.ListColorCode ='black', 'white', 'rgb','brg', '64 colors'
     13            % colcode.ColorCode ='black', 'white', 'rgb','brg', '64 colors'
    1414            % colcode.CheckFixVecColor =0; thresholds scaling relative to min and max, =1 fixed thresholds
    1515            % colcode.MinVec; min
     
    2222function [colorlist,col_vec,colcode_out]=set_col_vec(colcode,vec_C)
    2323col_vec=[];
     24if ~isstruct(colcode),colcode=[];end;
    2425colcode_out=colcode;%default
    2526if isempty(vec_C) || ~isnumeric(vec_C)
    26     colorlist=[0 0 1]; %blue 
     27    colorlist=[0 0 1]; %blue
    2728    col_vec=ones(size(vec_C));
    2829    return
    2930end
    30 if (isfield(colcode,'CheckFixVecColor') && isequal(colcode.CheckFixVecColor,1))
    31     minC=colcode.MinVec;
    32     maxC=colcode.MaxVec;
     31
     32
     33
     34% colcode_out.ColCode1=ColCode1;
     35% colcode_out.ColCode2=ColCode2;
     36%% uniform color plot
     37check_multicolors=0;
     38col_vec=ones(size(vec_C));%all vectors at color#1 by default
     39%default input parameters
     40if ~isfield(colcode,'ColorCode') || isempty(colcode.ColorCode)
     41    colorlist=[0 0 1]; %blue
    3342else
    34     minC=min(vec_C);
    35     maxC=max(vec_C);
     43    if strcmp(colcode.ColorCode,'black')
     44        colorlist(1,:)=[0 0 0];%black
     45    elseif strcmp(colcode.ColorCode,'white')
     46        colorlist(1,:)=[1 1 1];%white
     47    else
     48        check_multicolors=1;
     49    end
    3650end
    3751
    38 %default input parameters
    39 if ~isstruct(colcode),colcode=[];end;
    40 if ~isfield(colcode,'ListColorCode') || isempty(colcode.ListColorCode)
    41     colorlist=[0 0 1]; %blue 
    42     col_vec=ones(size(vec_C));
    43     return
     52if check_multicolors
     53    if (isfield(colcode,'CheckFixVecColor') && isequal(colcode.CheckFixVecColor,1))
     54        minC=colcode.MinVec;
     55        maxC=colcode.MaxVec;
     56    else
     57        minC=min(vec_C);
     58        maxC=max(vec_C);
     59    end
     60    colcode_out.MinC=minC;
     61    colcode_out.MaxC=maxC;
     62    if strcmp(colcode.ColorCode,'rgb')|| strcmp(colcode.ColorCode,'bgr')% 3 color representation
     63        if  isfield(colcode,'ColCode1')
     64            colcode_out.ColCode1=colcode.ColCode1;
     65        else
     66            colcode_out.ColCode1=minC+(maxC-minC)/3;%default
     67        end
     68        if  isfield(colcode,'ColCode2')
     69            colcode_out.ColCode2=colcode.ColCode2;
     70        else
     71            colcode_out.ColCode2=minC+2*(maxC-minC)/3;%default
     72        end
     73        colorlist(2,:)=[0 1 0];%green
     74        col_vec(vec_C < colcode_out.ColCode1)=1;% vectors with vec_C smaller than ColCode1 set to the first color (r or b)
     75        col_vec((vec_C >= colcode_out.ColCode1) & (vec_C < colcode_out.ColCode2))=2;% select green vectors
     76        col_vec(vec_C >= colcode_out.ColCode2)=3;
     77        if strcmp(colcode.ColorCode,'rgb')
     78            colorlist(1,:)=[1 0 0];%red
     79            colorlist(3,:)=[0 0 1];%blue
     80        else
     81            colorlist(1,:)=[0 0 1];%blue
     82            colorlist(3,:)=[1 0 0];%red
     83        end
     84    else
     85        colorjet=jet;% ususal colormap from blue to red
     86        sizlist=size(colorjet);
     87        indsel=ceil((sizlist(1)/64)*(1:64));
     88        colorlist(:,1)=colorjet(indsel,1);
     89        colorlist(:,2)=colorjet(indsel,2);
     90        colorlist(:,3)=colorjet(indsel,3);
     91        sizlist=size(colorlist);
     92        nblevel=sizlist(1);
     93        col2_1=maxC-minC;
     94        col_vec=1+floor(nblevel*(vec_C-minC)/col2_1);
     95        col_vec=col_vec.*(col_vec<= nblevel)+nblevel*(col_vec >nblevel);% take color #nblevel at saturation
     96        col_vec=col_vec.*(col_vec>= 1)+  (col_vec <1);% take color #1 for values below 1
     97    end
    4498end
    45 if  isfield(colcode,'ColCode1')
    46     ColCode1=minC+colcode.ColCode1*(maxC-minC);
    47 else
    48     ColCode1=minC+(maxC-minC)/3;%default
    49 end
    50 if isfield(colcode,'ColCode2')
    51     ColCode2=minC+colcode.ColCode2*(maxC-minC);
    52 else
    53     ColCode2=minC+2*(maxC-minC)/3;%default
    54 end
    55 colcode_out.MinC=minC;
    56 colcode_out.MaxC=maxC;
    57 if strcmp(colcode.ListColorCode,'black')
    58     colorlist(1,:)=[0 0 0];%black
    59     col_vec=ones(size(vec_C));%all vectors at color#1
    60 elseif strcmp(colcode.ListColorCode,'white')
    61     colorlist(1,:)=[1 1 1];%white
    62     col_vec=ones(size(vec_C));%all vectors at color#1
    63 elseif strcmp(colcode.ListColorCode,'rgb')|| strcmp(colcode.ListColorCode,'bgr')% 3 color representation
    64 %    ind1=find(vec_C < ColCode1); % =1 for red vectors
    65     ind_green=find((vec_C >= ColCode1) & (vec_C < ColCode2));% =1 for green vectors
    66 %     ind3=find(vec_C >= ColCode2);% =1 for blue vectors
    67     colorlist(2,:)=[0 1 0];%green
    68     col_vec(vec_C < ColCode1)=1;
    69     col_vec(ind_green)=2;
    70     col_vec(vec_C >= ColCode2)=3;
    71     if strcmp(colcode.ListColorCode,'rgb')
    72         colorlist(1,:)=[1 0 0];%red
    73         colorlist(3,:)=[0 0 1];%blue
    74     else
    75         colorlist(1,:)=[0 0 1];%blue
    76         colorlist(3,:)=[1 0 0];%red
    77     end
    78 else
    79     colorjet=jet;% ususal colormap from blue to red
    80     sizlist=size(colorjet);
    81     indsel=ceil((sizlist(1)/64)*(1:64));
    82     colorlist(:,1)=colorjet(indsel,1);
    83     colorlist(:,2)=colorjet(indsel,2);
    84     colorlist(:,3)=colorjet(indsel,3);
    85     sizlist=size(colorlist);
    86     nblevel=sizlist(1);
    87     col2_1=maxC-minC;
    88     col_vec=1+floor(nblevel*(vec_C-minC)/col2_1);
    89     col_vec=col_vec.*(col_vec<= nblevel)+nblevel*(col_vec >nblevel);% take color #nblevel at saturation
    90     col_vec=col_vec.*(col_vec>= 1)+  (col_vec <1);% take color #1 for values below 1
    91 end
  • trunk/src/sub_field.m

    r402 r405  
    1717
    1818function [SubData,errormsg]=sub_field(Field,Field_1)
     19
     20%% global attributes
    1921test_attr=0;
    2022if isfield(Field,'ListGlobalAttribute')
     
    2224    for ilist=1:numel(Field.ListGlobalAttribute)
    2325        AttrName=Field.ListGlobalAttribute{ilist};
    24         eval(['SubData.' AttrName '=Field.' AttrName ';'])
     26        SubData.(AttrName)=Field.(AttrName);
    2527    end
    2628    test_attr=1;
     
    4951    end
    5052end
     53
     54%% variables
    5155SubData.ListVarName=Field.ListVarName;
    5256SubData.VarDimName=Field.VarDimName;
     
    5458    SubData.VarAttribute=Field.VarAttribute;
    5559end
    56 %reproduce Field by default
     60%reproduce the first field Field by default
    5761for ivar=1:numel(Field.ListVarName)
    5862   VarName=Field.ListVarName{ivar};
    59    eval(['SubData.' VarName '=Field.' VarName ';'])
    60 end
    61 
    62 %fields     
     63   SubData.(VarName)=Field.(VarName);
     64end
     65
     66%% check the two input fields     
    6367[CellVarIndex,NbDim,VarTypeCell,errormsg]=find_field_indices(Field);
    6468if ~isempty(errormsg)
     
    111115end
    112116
    113 %substract two vector fields or two scalars
     117%% substract two vector fields or two scalars
    114118if (testU && testU_1) || (~testU && ~testU_1)
    115119   %check coincidence in positions
     
    118122       XName=Field.ListVarName{VarType.coord_x};
    119123       YName=Field.ListVarName{VarType.coord_y};
    120        eval(['vec_X=Field.' XName ';'])
    121        eval(['vec_Y=Field.' YName ';'])
     124       vec_X=Field.(XName);
     125       vec_Y=Field.(YName);
    122126       nbpoints=numel(vec_X);
    123127       vec_X=reshape(vec_X,nbpoints,1);
     
    361365                VName_1_1=[VName_1 '_1'];
    362366        end
    363     end     
     367    end   
     368   
    364369    if ~testX_1
    365370          DimCell=[{XName_1_1} {YName_1_1}];
     
    376381        SubData.VarAttribute=[SubData.VarAttribute {XAttr} {YAttr} {UAttr} {VAttr}];
    377382    end
    378     eval(['SubData.' XName_1_1 '=Field_1.' XName_1 ';'])
    379     eval(['SubData.' YName_1_1 '=Field_1.' YName_1 ';'])
    380     eval(['SubData.' UName_1_1 '=Field_1.' UName_1 ';'])
    381     eval(['SubData.' VName_1_1 '=Field_1.' VName_1 ';'])
     383    SubData.(XName_1_1)=Field_1.(XName_1);
     384    SubData.(YName_1_1)=Field_1.(YName_1);
     385    SubData.(UName_1_1)=Field_1.(UName_1);
     386    SubData.(VName_1_1)=Field_1.(VName_1);
    382387end
    383388 
  • trunk/src/uvmat.m

    r404 r405  
    769769                Input.RootFile_1=Input.RootFile;
    770770            end
     771            if ~isfield(Input,'FileExt_1')||strcmp(Input.FileExt_1,'"')
     772                Input.FileExt_1=Input.FileExt;
     773            end
     774            if ~isfield(Input,'NomType_1')||strcmp(Input.NomType_1,'"')
     775                Input.NomType_1=Input.NomType;
     776            end
    771777            %updtate the indices of the second field series to correspond to the newly opened one
    772778            FileName_1=fullfile_uvmat(Input.RootPath_1,Input.SubDir_1,Input.RootFile_1,Input.FileExt_1,Input.NomType_1,i1,i2,j1,j2);
     
    10741080            col_vec={'get_field...'};
    10751081        end
    1076         set(handles.ListColorScalar,'String',col_vec)
     1082        set(handles.ColorScalar,'String',col_vec)
    10771083    end
    10781084end
     
    20042010            end
    20052011            if strcmp(FieldName,'velocity')
    2006                 list_code=get(handles.ListColorCode,'String');% list menu fields
    2007                 index_code=get(handles.ListColorCode,'Value');% selected string index
     2012                list_code=get(handles.ColorCode,'String');% list menu fields
     2013                index_code=get(handles.ColorCode,'Value');% selected string index
    20082014                if  ~strcmp(list_code{index_code},'black') &&  ~strcmp(list_code{index_code},'white')
    2009                     list_code=get(handles.ListColorScalar,'String');% list menu fields
    2010                     index_code=get(handles.ListColorScalar,'Value');% selected string index
     2015                    list_code=get(handles.ColorScalar,'String');% list menu fields
     2016                    index_code=get(handles.ColorScalar,'Value');% selected string index
    20112017                    ParamIn.ColorVar= list_code{index_code}; % selected field
    20122018                end
     
    20432049end
    20442050
    2045 %% choose a second field filename_1 if defined
     2051%% choose and read a second field filename_1 if defined
    20462052VelType_1=[];%default
    20472053FieldName_1=[];
     
    20532059    end
    20542060    Name=filename_1;
    2055 %     FileType_1=UvData.FileType{2};
    20562061    switch UvData.FileType{2}
    20572062        case {'civx','civdata','netcdf'};
     
    20642069                end
    20652070            end
    2066             if strcmp(FieldName_1,'velocity')
    2067                 list_code=get(handles.ListColorCode,'String');% list menu fields
    2068                 index_code=get(handles.ListColorCode,'Value');% selected string index
     2071            if strcmp(FieldName_1,'velocity')&& strcmp(get(handles.ColorCode,'Visible'),'on')
     2072                list_code=get(handles.ColorCode,'String');% list menu fields
     2073                index_code=get(handles.ColorCode,'Value');% selected string index
    20692074                if  ~strcmp(list_code{index_code},'black') &&  ~strcmp(list_code{index_code},'white')
    2070                     list_code=get(handles.ListColorScalar,'String');% list menu fields
    2071                     index_code=get(handles.ListColorScalar,'Value');% selected string index
    2072                     ParamIn.ColorVar= list_code{index_code}; % selected field
     2075                    list_code=get(handles.ColorScalar,'String');% list menu fields
     2076                    index_code=get(handles.ColorScalar,'Value');% selected string index
     2077                    ParamIn_1.ColorVar= list_code{index_code}; % selected field for vector color display                 
    20732078                end
    20742079            end
     
    20772082        case 'vol' %TODO: update
    20782083            if isfield(UvData.XmlData,'Npy') && isfield(UvData.XmlData,'Npx')
    2079                 ParamIn.Npy=UvData.XmlData.Npy;
    2080                 ParamIn.Npx=UvData.XmlData.Npx;
     2084                ParamIn_1.Npy=UvData.XmlData.Npy;
     2085                ParamIn_1.Npx=UvData.XmlData.Npx;
    20812086            else
    20822087                errormsg='Npx and Npy need to be defined in the xml file for volume images .vol';
     
    20942099        Field{2}=UvData.Field_1;% keep the stored field
    20952100    else
    2096         ParamIn.FieldName=FieldName_1;
    2097         ParamIn.VelType=VelType_1;
    2098         ParamIn.GUIName='get_field_1';
    2099         [Field{2},ParamOut_1,errormsg] = read_field(Name,UvData.FileType{2},ParamIn,num_i1);
     2101        ParamIn_1.FieldName=FieldName_1;
     2102        ParamIn_1.VelType=VelType_1;
     2103        ParamIn_1.GUIName='get_field_1';
     2104        [Field{2},ParamOut_1,errormsg] = read_field(Name,UvData.FileType{2},ParamIn_1,num_i1);
    21002105        if ~isempty(errormsg)
    21012106            errormsg=['error in reading ' FieldName_1 ' in ' filename_1 ': ' errormsg];
    21022107            return
    21032108        end
    2104         UvData.Field_1=Field{2}; %store the second field for possible use at next RUN
    2105     end
    2106     %     end
     2109%         UvData.Field_1=Field{2}; %store the second field for possible use at next RUN
     2110    end
    21072111end
    21082112
     
    21392143    set(handles.VelType,'Visible','off')
    21402144end
     2145% display the Fields menu from the input file and pick the selected one:
    21412146field_index=strcmp(ParamOut.FieldName,ParamOut.FieldList);
    21422147set(handles.Fields,'String',ParamOut.FieldList); %update the field menu
     
    21442149
    21452150%% update the display menu for the second velocity type (second menuline)
     2151
    21462152test_veltype_1=0;
    21472153if isempty(filename_1)
    21482154    set(handles.Fields_1,'Value',1); %update the field menu
    21492155    set(handles.Fields_1,'String',[{''};ParamOut.FieldList]); %update the field menu
    2150 else
     2156elseif ~test_keepdata_1
    21512157    if (~strcmp(UvData.FileType{2},'netcdf')&&~strcmp(UvData.FileType{2},'civdata')&&~strcmp(UvData.FileType{2},'civx'))|| isequal(FieldName_1,'get_field...')
    21522158        set(handles.VelType_1,'Visible','off')
    2153     else 
     2159    else
    21542160        test_veltype_1=1;
    21552161        set(handles.VelType_1,'Visible','on')
    2156         if ~get(handles.FixVelType,'Value')
     2162%         if ~get(handles.FixVelType,'Value')
    21572163            menu=set_veltype_display(ParamOut_1.CivStage);
    21582164            index_menu=strcmp(ParamOut_1.VelType,menu);
    21592165            set(handles.VelType_1,'Value',1+find(index_menu,1))
    21602166            set(handles.VelType_1,'String',[{''};menu])
    2161         end
    2162     end
     2167%         end
     2168    end
     2169    % update the second field menu: the same quantity
     2170    set(handles.Fields_1,'String',[{''};ParamOut_1.FieldList]); %update the field menu
     2171    % display the Fields menu from the input file and pick the selected one:
     2172    field_index=strcmp(ParamOut_1.FieldName,ParamOut_1.FieldList);
     2173    set(handles.Fields_1,'Value',find(field_index,1)+1) 
     2174%     % synchronise  with the first menu if the first selection is not 'velocity'
     2175%     if ~strcmp(ParamOut.FieldName,'velocity')
     2176%         field_index=strcmp(ParamOut_1.FieldName,ParamOut_1.FieldList);
     2177%         set(handles.Fields_1,'Value',field_index); %update the field menu
     2178%         ParamOut_1.FieldName=ParamOut.FieldName;
     2179%         set(handles.Fields_1,'String',ParamOut_1.FieldList)
     2180%     end
    21632181end
    21642182if test_veltype||test_veltype_1
     
    21672185     set(handles.FixVelType,'Visible','off')
    21682186end
     2187
     2188% field_index=strcmp(ParamOut_1.FieldName,ParamOut_1.FieldList);
     2189% set(handles.Fields,'String',ParamOut.FieldList); %update the field menu
     2190% set(handles.Fields,'Value',find(field_index,1))
    21692191   
    21702192%% introduce w as background image by default for a new series (only for nbdim=2)
     
    22112233    Field{1}.ZIndex=z_index;
    22122234end
    2213 %px to phys or other transform on field
    22142235if ~isempty(transform)
    22152236    if length(Field)>=2
     
    22432264
    22442265%% calculate scalar
    2245 % if (strcmp(FileType,'civdata')||strcmp(FileType,'civx'))&&~strcmp(ParamOut.FieldName,'velocity')&& ~strcmp(ParamOut.FieldName,'get_field...');% ~isequal(ParamOut.CivStage,0)%&&~isempty(FieldName)%
    2246 %     Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1});
    2247 % end
    2248 % if numel(Field)==2 && ~test_keepdata_1 && (strcmp(FileType,'civdata')||strcmp(FileType,'civx'))  &&~strcmp(ParamOut.FieldName,'velocity') && ~strcmp(ParamOut_1.FieldName,'get_field...')
    2249 %      Field{2}=calc_field([{ParamOut_1.FieldName} {ParamOut_1.ColorVar}],Field{2});
    2250 % end
     2266if (strcmp(UvData.FileType{1},'civdata')||strcmp(UvData.FileType{1},'civx'))%&&~strcmp(ParamOut.FieldName,'velocity')&& ~strcmp(ParamOut.FieldName,'get_field...');% ~isequal(ParamOut.CivStage,0)%&&~isempty(FieldName)%
     2267    Field{1}=calc_field([{ParamOut.FieldName} {ParamOut.ColorVar}],Field{1});
     2268end
     2269if numel(Field)==2 && ~test_keepdata_1 && (strcmp(UvData.FileType{2},'civdata')||strcmp(UvData.FileType{2},'civx'))  &&~strcmp(ParamOut_1.FieldName,'velocity') && ~strcmp(ParamOut_1.FieldName,'get_field...')
     2270     Field{2}=calc_field([{ParamOut_1.FieldName} {ParamOut_1.ColorVar}],Field{2});
     2271end
    22512272
    22522273%% combine the two input fields (e.g. substract velocity fields)
    2253 Field{1}.FieldList=[{ParamOut.FieldName} {ParamOut.ColorVar}];
     2274%Field{1}.FieldList=[{ParamOut.FieldName} {ParamOut.ColorVar}];
    22542275if numel(Field)==2
    2255     Field{2}.FieldList=[{ParamOut_1.FieldName} {ParamOut_1.ColorVar}];
     2276%    Field{2}.FieldList=[{ParamOut_1.FieldName} {ParamOut_1.ColorVar}];
    22562277   [UvData.Field,errormsg]=sub_field(Field{1},Field{2}); 
     2278   UvData.Field_1=Field{2}; %store the second field for possible use at next RUN
    22572279else
    22582280   UvData.Field=Field{1};
     
    24232445
    24242446%% reset the min and max of scalar if only the mask is displayed(TODO: check the need)
    2425 if isfield(UvData,'Mask')&& ~isfield(UvData,'A')
    2426     set(handles.num_MinA,'String','0')
    2427     set(handles.num_MaxA,'String','255')
    2428 end
     2447% if isfield(UvData,'Mask')&& ~isfield(UvData,'A')
     2448%     set(handles.num_MinA,'String','0')
     2449%     set(handles.num_MaxA,'String','255')
     2450% end
    24292451
    24302452%% Plot the projections on the selected  projection objects
     
    24482470%PlotParam{1}=read_plot_param(handles);%read plotting parameters on the uvmat interfac
    24492471PlotParam{1}=read_GUI(handles.uvmat);
     2472%default settings if vectors not visible (should not be needed)
    24502473if ~isfield(PlotParam{1},'Vectors')
    24512474    PlotParam{1}.Vectors.MaxVec=1;
     
    24542477    PlotParam{1}.Vectors.ColCode1=0.33;
    24552478    PlotParam{1}.Vectors.ColCode2=0.66;
    2456      PlotParam{1}.Vectors.ListColorScalar={'ima_cor'};
    2457      PlotParam{1}.Vectors.ListColorCode= {'rgb'};
     2479    PlotParam{1}.Vectors.ColorScalar={'ima_cor'};
     2480    PlotParam{1}.Vectors.ColorCode= {'rgb'};
    24582481end
    24592482%keeplim(1)=get(handles.CheckFixLimits,'Value');% test for fixed graph limits
     
    24662489        plot_handles{2}=guidata(view_field_handle);
    24672490        haxes(2)=plot_handles{2}.axes3;
    2468         %PlotParam{2}=read_plot_param(plot_handles{2});%read plotting parameters on the viewinterface
    24692491        PlotParam{2}=read_GUI(handles.uvmat);%read plotting parameters on the uvmat interface
    2470        % keeplim(2)=get(plot_handles{2}.CheckFixLimits,'Value');
    24712492        PosColorbar{2}='*'; %TODO: deal with colorbar position on view_field
    24722493    end
    24732494end
    24742495
    2475 %loop on the projection objects: one or two
     2496%% loop on the projection objects: one or two
    24762497for imap=1:numel(IndexObj)
    24772498    iobj=IndexObj(imap);
    2478      if iobj==1 && ~isfield(UvData.Object{iobj},'Type')% case with no projection (only for the first empty object)
    2479          [ObjectData,errormsg]=calc_field(UvData.Field.FieldList,UvData.Field);
    2480      else
     2499%      if imap==2 || check_proj==0  % field not yet projected) && ~isfield(UvData.Object{iobj},'Type')% case with no projection (only for the first empty object)
     2500% %          [ObjectData,errormsg]=calc_field(UvData.Field.FieldList,UvData.Field);
     2501% %      else
    24812502        [ObjectData,errormsg]=proj_field(UvData.Field,UvData.Object{iobj});% project field on the object
    2482      end
     2503%      end
    24832504    if ~isempty(errormsg)
    24842505        return
     
    29913012UvData.filename_1='';% desactivate the use of a constant second file
    29923013list_fields=get(handles.Fields,'String');% list menu fields
    2993 index_fields=get(handles.Fields,'Value');% selected string index
    2994 field= list_fields{index_fields(1)}; % selected string
     3014field= list_fields{get(handles.Fields,'Value')}; % selected string
    29953015list_fields=get(handles.Fields_1,'String');% list menu fields
    2996 index_fields=get(handles.Fields_1,'Value');% selected string index
    2997 field_1= list_fields{index_fields(1)}; % selected string for the second field
    2998 if isequal(field_1,'')||(numel(UvData.FileType)>=2 && strcmp(UvData.FileType{2},'image'))
     3016field_1= list_fields{get(handles.Fields_1,'Value')}; % selected string for the second field
     3017if isempty(field_1)%||(numel(UvData.FileType)>=2 && strcmp(UvData.FileType{2},'image'))
    29993018    set(handles.SubField,'Value',0)
    3000     check_new=1;
     3019%     check_new=1;
    30013020    SubField_Callback(hObject, eventdata, handles)
    3002     if isempty(field_1)%remove second field if 'blank' field is selected
     3021%     if isempty(field_1)%remove second field if 'blank' field is selected
    30033022        return
    3004     end
    3005 end
    3006 set(handles.SubField,'Value',1)%state that a second field is now entered
     3023%     end
     3024else
     3025    set(handles.SubField,'Value',1)%state that a second field is now entered
     3026end
    30073027
    30083028%% read the rootfile input display
    3009 [RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1,NomTYpe_1]=read_file_boxes_1(handles);
     3029[RootPath_1,SubDir_1,RootFile_1,FileIndex_1,FileExt_1]=read_file_boxes_1(handles);
    30103030filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndex_1 FileExt_1];
    30113031[tild,tild,tild,i1,i2,j1,j2]=fileparts_uvmat(get(handles.FileIndex,'String'));
    3012 set(handles.FileIndex_1,'Visible','on')
    3013 set(handles.FileExt_1,'Visible','on')
     3032% set(handles.FileIndex_1,'Visible','on')
     3033% set(handles.FileExt_1,'Visible','on')
    30143034switch field_1
    30153035    case 'get_field...'
     
    30273047        set(handles.path_transform,'String','')
    30283048    case 'image'
    3029         % transform netc type to the corresponding image type
    3030         NomType=get(handles.NomType,'string');
    3031         check_letter=~isempty(regexp(NomType,'[ab|AB]$'));%detect pair label by letter
    3032 %         NomType_1=NomType;
    3033 %         if check_letter
    3034 %             NomType_1=NomType_1(1:end-1);
    3035 %         else
    3036 %             r=regexp(NomType_1,'.-(?<num2>\d+$','names');
    3037 %             if ~isempty(r)
    3038 %                 NomType_1=regexprep(NomType_1,['-' r.num2],'');
    3039 %             end
    3040 %         end
    3041         imagename=fullfile_uvmat(RootPath_1,'',RootFile_1,'.png',NomType,i1,[],j1);
    3042         if ~exist(imagename,'file')
     3049        % guess the image name corresponding to the current netcdf name (no unique correspondance)
     3050        imagename=fullfile_uvmat(RootPath_1,'',RootFile_1,'.png',get(handles.NomType,'String'),i1,[],j1);
     3051        if ~exist(imagename,'file') % browse for images if it is not found
    30433052            [FileName,PathName] = uigetfile( ...
    30443053                {'*.png;*.jpg;*.tif;*.avi;*.AVI;*.vol', ' (*.png, .tif, *.avi,*.vol)';
     
    30503059                '*.*',  'All Files (*.*)'}, ...
    30513060                'Pick an image',imagename);
    3052             % display the selected field and related information
    30533061            imagename=[PathName FileName];
    30543062        end
    3055         set(handles.TitleNpx,'Visible','on')% visible npx,pxcm... buttons
    3056         set(handles.TitleNpy,'Visible','on')
    3057         set(handles.num_Npx,'Visible','on')
    3058         set(handles.num_Npy,'Visible','on')
    3059         display_file_name(hObject, eventdata, handles,imagename,2)%display the imag
     3063        if ~ischar(imagename)% quit if the browser has  been closed
     3064            set(handles.SubField,'Value',0)
     3065        else %valid browser input:  display the selected image
     3066            set(handles.TitleNpx,'Visible','on')% visible npx,pxcm... buttons
     3067            set(handles.TitleNpy,'Visible','on')
     3068            set(handles.num_Npx,'Visible','on')
     3069            set(handles.num_Npy,'Visible','on')
     3070            display_file_name(hObject, eventdata, handles,imagename,2)%display the imag
     3071        end
    30603072    otherwise
    30613073        if check_new
     
    30713083        end
    30723084        set(handles.uvmat,'UserData',UvData)
    3073 %         setfield(handles);% update the field structure ('civ1'....)
    30743085        if ~(isfield(UvData,'NewSeries')&&isequal(UvData.NewSeries,1))
    30753086            run0_Callback(hObject, eventdata, handles)
     
    31123123        end
    31133124end
    3114 
    3115 
    3116 
    31173125menu=menu(1:imax);
    31183126
     
    31213129function FixVelType_Callback(hObject, eventdata, handles)
    31223130%------------------------------------------------------------------------
    3123 val=get(handles.FixVelType,'Value');
    3124 if ~val
     3131% refresh the current plot if the fixed  veltype is unselected
     3132if ~get(handles.FixVelType,'Value')
    31253133    run0_Callback(hObject, eventdata, handles)
    31263134end
     
    31373145function VelType_1_Callback(hObject, eventdata, handles)
    31383146%------------------------------------------------------------------------
    3139  
    31403147set(handles.FixVelType,'Value',1)% the velocity type is now imposed by the GUI (not automatic)
    31413148UvData=get(handles.uvmat,'UserData');
    3142 %refresh field with a second filename=first fiel name
     3149%refresh field with a second filename=first file name
    31433150set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow
    31443151drawnow   
     
    31463153[RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
    31473154filename=[fullfile(RootPath,SubDir,RootFile) FileIndices FileExt];
    3148 % VelTypeList=get(handles.VelType_1,'String');
    3149 % VelType_1=VelTypeList{get(handles.VelType_1,'Value')};
     3155
    31503156if isempty(InputFile.VelType_1)
    31513157        filename_1='';% we plot the current field without the second field
     
    31553161      [RootPath_1,SubDir_1,RootFile_1,FileIndices_1,FileExt_1]=read_file_boxes_1(handles);
    31563162     filename_1=[fullfile(RootPath_1,SubDir_1,RootFile_1) FileIndices_1 FileExt_1];
    3157 %       UvData.VelType{2}=InputFile.VelType_1;
    3158 else
    3159      filename_1=filename;% we compare two fields in the same file
     3163else
     3164     filename_1=filename;% we compare two fields in the same file by default
    31603165     UvData.FileType{2}=UvData.FileType{1};
    3161 %      UvData.VelType{2}=InputFile.VelType_1;
    31623166     set(handles.SubField,'Value',1)
    31633167end
     
    33693373%------------------------------------------------------------------
    33703374
    3371 %------------------------------------------------------------------
    3372 % --- Executes on selection change in ListColorScalar: choice of the color code.
    3373 function ListColorScalar_Callback(hObject, eventdata, handles)
    3374 %------------------------------------------------------------------
    3375 % edit the choice for color code
    3376 list_code=get(handles.ListColorScalar,'String');% list menu fields
    3377 index_code=get(handles.ListColorScalar,'Value');% selected string index
    3378 col_code= list_code{index_code(1)}; % selected field
    3379 if isequal(col_code,'black') || isequal(col_code,'white')
    3380    set(handles.Slider1,'Visible','off')
    3381    set(handles.Slider2,'Visible','off')
    3382    set(handles.num_ColCode1,'Visible','off')
    3383    set(handles.num_ColCode2,'Visible','off')
    3384    set(handles.CheckFixVecColor,'Visible','off')
    3385    set_vec_col_bar(handles)
    3386 else
    3387    set(handles.Slider1,'Visible','on')
    3388    set(handles.Slider2,'Visible','on')
    3389    set(handles.num_ColCode1,'Visible','on')
    3390    set(handles.num_ColCode2,'Visible','on')
    3391    set(handles.CheckFixVecColor,'Visible','on') 
    3392    if isequal(col_code,'ima_cor')
    3393        set(handles.CheckFixVecColor,'Value',0)%fixed scale by default
    3394        set(handles.VecColBar,'Value',0)% 3 colors r,g,b by default
    3395        set(handles.Slider1,'Min',0);
    3396        set(handles.Slider1,'Max',1);
    3397        set(handles.Slider2,'Min',0);
    3398        set(handles.Slider2,'Max',1);
    3399  %      set(handles.min_title_vec,'String','0')
    3400        set(handles.num_MaxVec,'String','1')
    3401        set(handles.num_ColCode1,'String','0.333')
    3402        num_ColCode1_Callback(hObject, eventdata, handles)
    3403        set(handles.num_ColCode2,'String','0.666')
    3404        num_ColCode2_Callback(hObject, eventdata, handles)
    3405    else
    3406        set(handles.CheckFixVecColor,'Value',1)%auto scale between min,max by default
    3407        set(handles.VecColBar,'Value',1)% colormap 'jet' by default
    3408        minval=get(handles.Slider1,'Min');
    3409        maxval=get(handles.Slider1,'Max');
    3410        set(handles.Slider1,'Value',minval)
    3411        set(handles.Slider2,'Value',maxval)
    3412        set_vec_col_bar(handles)
    3413    end
    3414 %    slider_update(handles)
    3415 end
    3416 %replot the current graph
    3417 run0_Callback(hObject, eventdata, handles)
    3418 
    3419 
    3420 %----------------------------------------------------------------
    3421 % -- Executes on slider movement to set the color code
    3422 %
    3423 function Slider1_Callback(hObject, eventdata, handles)
    3424 %------------------------------------------------------------------
    3425 slider1=get(handles.Slider1,'Value');
    3426 min_val=str2num(get(handles.num_MinVec,'String'));
    3427 max_val=str2num(get(handles.num_MaxVec,'String'));
    3428 col=min_val+(max_val-min_val)*slider1;
    3429 set(handles.num_ColCode1,'String',num2str(col))
    3430 if(get(handles.Slider2,'Value') < col)%move also the second slider at the same value if needed
    3431     set(handles.Slider2,'Value',col)
    3432     set(handles.num_ColCode2,'String',num2str(col))
    3433 end
    3434 num_ColCode1_Callback(hObject, eventdata, handles)
    3435 
    3436 %----------------------------------------------------------------
    3437 % Executes on slider movement to set the color code
    3438 %----------------------------------------------------------------
    3439 function Slider2_Callback(hObject, eventdata, handles)
    3440 slider2=get(handles.Slider2,'Value');
    3441 min_val=str2num(get(handles.num_MinVec,'String'));
    3442 max_val=str2num(get(handles.num_MaxVec,'String'));
    3443 col=min_val+(max_val-min_val)*slider2;
    3444 set(handles.num_ColCode2,'String',num2str(col))
    3445 if(get(handles.Slider1,'Value') > col)%move also the first slider at the same value if needed
    3446     set(handles.Slider1,'Value',col)
    3447     set(handles.num_ColCode1,'String',num2str(col))
    3448 end
    3449 num_ColCode2_Callback(hObject, eventdata, handles)
    3450 
    3451 %----------------------------------------------------------------
    3452 % --- Execute on return carriage on the edit box corresponding to slider 1
    3453 %----------------------------------------------------------------
    3454 function num_ColCode1_Callback(hObject, eventdata, handles)
    3455 set_vec_col_bar(handles)
    3456 update_plot(handles);
    3457 
    3458 %----------------------------------------------------------------
    3459 % --- Execute on return carriage on the edit box corresponding to slider 2
    3460 %----------------------------------------------------------------
    3461 function num_ColCode2_Callback(hObject, eventdata, handles)
    3462 set_vec_col_bar(handles)
    3463 update_plot(handles);
    3464 %------------------------------------------------------------------------
    3465 %-------------------------------------------------------
    3466 % --- Executes on button press in CheckFixVecColor.
    3467 %-------------------------------------------------------
    3468 function VecColBar_Callback(hObject, eventdata, handles)
    3469 set_vec_col_bar(handles)
     3375
    34703376
    34713377%-------------------------------------------------------------
     
    36493555%CALLBACKS FOR PLOTTING PARAMETERS
    36503556%-------------------------------------------------
    3651 
     3557%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     3558% Plot coordinates
     3559%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    36523560%------------------------------------------------------------------------
    36533561function num_MinX_Callback(hObject, eventdata, handles)
     
    36783586update_plot(handles);
    36793587
     3588%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     3589% Scalar or image representation
     3590%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    36803591%------------------------------------------------------------------------
    36813592function num_MinA_Callback(hObject, eventdata, handles)
     
    37443655update_plot(handles);
    37453656
     3657
     3658%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     3659% Vector representation
     3660%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    37463661%-------------------------------------------------------------------
    37473662function CheckHideWarning_Callback(hObject, eventdata, handles)
     
    37803695
    37813696%------------------------------------------------------------------------
    3782 % --- Executes on selection change in ListColorCode menu
    3783 function ListColorCode_Callback(hObject, eventdata, handles)
    3784 %------------------------------------------------------------------------
     3697% --- Executes on selection change in ColorCode menu
     3698function ColorCode_Callback(hObject, eventdata, handles)
     3699%------------------------------------------------------------------------
     3700% edit the choice for color code
     3701update_color_code_boxes(handles);
     3702update_plot(handles);
     3703
     3704%------------------------------------------------------------------------
     3705function update_color_code_boxes(handles)
     3706%------------------------------------------------------------------------
     3707list_code=get(handles.ColorCode,'String');% list menu fields
     3708colcode= list_code{get(handles.ColorCode,'Value')}; % selected field
     3709enable_slider='off';%default
     3710enable_bounds='off';%default
     3711enable_scalar='off';%default
     3712switch colcode
     3713    case {'rgb','bgr'}
     3714        enable_slider='on';
     3715        enable_bounds='on';
     3716        enable_scalar='on';
     3717    case '64 colors'
     3718        enable_bounds='on';
     3719        enable_scalar='on';
     3720end
     3721set(handles.Slider1,'Visible',enable_slider)
     3722set(handles.Slider2,'Visible', enable_slider)
     3723set(handles.num_ColCode1,'Visible',enable_slider)
     3724set(handles.num_ColCode2,'Visible',enable_slider)
     3725set(handles.TitleColCode1,'Visible',enable_slider)
     3726set(handles.TitleColCode2,'Visible',enable_slider)
     3727set(handles.CheckFixVecColor,'Visible',enable_bounds)
     3728set(handles.num_MinVec,'Visible',enable_bounds)
     3729set(handles.num_MaxVec,'Visible',enable_bounds)
     3730set(handles.ColorScalar,'Visible',enable_scalar)
     3731set_vec_col_bar(handles)
     3732
     3733%------------------------------------------------------------------
     3734% --- Executes on selection change in ColorScalar: choice of the color code.
     3735function ColorScalar_Callback(hObject, eventdata, handles)
     3736%------------------------------------------------------------------
     3737% edit the choice for color code
     3738list_scalar=get(handles.ColorScalar,'String');% list menu fields
     3739col_scalar= list_scalar{get(handles.ColorScalar,'Value')}; % selected field
     3740if isequal(col_scalar,'ima_cor')
     3741    set(handles.CheckFixVecColor,'Value',1)%fixed scale by default
     3742    ColorCode='rgb';
     3743    set(handles.num_MinVec,'String','0')
     3744    set(handles.num_MaxVec,'String','1')
     3745    set(handles.num_ColCode1,'String','0.333')
     3746    set(handles.num_ColCode2,'String','0.666')
     3747else
     3748    set(handles.CheckFixVecColor,'Value',0)%auto scale between min,max by default
     3749    ColorCode='64 colors';
     3750end
     3751ColorCodeList=get(handles.ColorCode,'String');
     3752ichoice=find(strcmp(ColorCode,ColorCodeList),1);
     3753set(handles.ColorCode,'Value',ichoice)% set color code in the menu
     3754
     3755update_color_code_boxes(handles);
     3756%replot the current graph
     3757run0_Callback(hObject, eventdata, handles)
     3758
     3759%----------------------------------------------------------------
     3760% -- Executes on slider movement to set the color code
     3761%
     3762function Slider1_Callback(hObject, eventdata, handles)
     3763%------------------------------------------------------------------
     3764slider1=get(handles.Slider1,'Value');
     3765min_val=str2num(get(handles.num_MinVec,'String'));
     3766max_val=str2num(get(handles.num_MaxVec,'String'));
     3767col=min_val+(max_val-min_val)*slider1;
     3768set(handles.num_ColCode1,'String',num2str(col))
     3769if(get(handles.Slider2,'Value') < col)%move also the second slider at the same value if needed
     3770    set(handles.Slider2,'Value',col)
     3771    set(handles.num_ColCode2,'String',num2str(col))
     3772end
    37853773set_vec_col_bar(handles)
    37863774update_plot(handles);
    37873775
     3776%----------------------------------------------------------------
     3777% Executes on slider movement to set the color code
     3778%----------------------------------------------------------------
     3779function Slider2_Callback(hObject, eventdata, handles)
     3780slider2=get(handles.Slider2,'Value');
     3781min_val=str2num(get(handles.num_MinVec,'String'));
     3782max_val=str2num(get(handles.num_MaxVec,'String'));
     3783col=min_val+(max_val-min_val)*slider2;
     3784set(handles.num_ColCode2,'String',num2str(col))
     3785if(get(handles.Slider1,'Value') > col)%move also the first slider at the same value if needed
     3786    set(handles.Slider1,'Value',col)
     3787    set(handles.num_ColCode1,'String',num2str(col))
     3788end
     3789set_vec_col_bar(handles)
     3790update_plot(handles);
     3791
     3792%----------------------------------------------------------------
     3793% --- Execute on return carriage on the edit box corresponding to slider 1
     3794%----------------------------------------------------------------
     3795function num_ColCode1_Callback(hObject, eventdata, handles)
     3796set_vec_col_bar(handles)
     3797update_plot(handles);
     3798
     3799%----------------------------------------------------------------
     3800% --- Execute on return carriage on the edit box corresponding to slider 2
     3801%----------------------------------------------------------------
     3802function num_ColCode2_Callback(hObject, eventdata, handles)
     3803set_vec_col_bar(handles)
     3804update_plot(handles);
     3805%------------------------------------------------------------------------
     3806%-------------------------------------------------------
     3807% --- Executes on button press in CheckFixVecColor.
     3808%-------------------------------------------------------
     3809function VecColBar_Callback(hObject, eventdata, handles)
     3810set_vec_col_bar(handles)
     3811
    37883812%------------------------------------------------------------------------
    37893813% --- Executes on button press in CheckFixVecColor.
    37903814function CheckFixVecColor_Callback(hObject, eventdata, handles)
    37913815%------------------------------------------------------------------------
    3792 test=get(handles.CheckFixVecColor,'Value');
    3793 if test
    3794     set(handles.CheckFixVecColor,'BackgroundColor',[1 1 0])
    3795 else
     3816if ~get(handles.CheckFixVecColor,'Value')
    37963817    update_plot(handles);
    3797     %set(handles.num_VecScale,'String',num2str(ScalOut.num_VecScale,3))
    3798     set(handles.CheckFixVecColor,'BackgroundColor',[0.7 0.7 0.7])
    37993818end
    38003819
     
    38223841
    38233842%------------------------------------------------------------------------
    3824 % --- update the display of color code for vectors
     3843% --- update the display of color code for vectors (on vecColBar)
    38253844function set_vec_col_bar(handles)
    38263845%------------------------------------------------------------------------
     
    38333852
    38343853%get slider indications
    3835 list=get(handles.ListColorCode,'String');
    3836 ichoice=get(handles.ListColorCode,'Value');
    3837 colcode.ListColorCode=list{ichoice};
     3854list=get(handles.ColorCode,'String');
     3855ichoice=get(handles.ColorCode,'Value');
     3856colcode.ColorCode=list{ichoice};
    38383857colcode.MinVec=str2num(get(handles.num_MinVec,'String'));
    38393858colcode.MaxVec=str2num(get(handles.num_MaxVec,'String'));
    3840 test3color=strcmp(colcode.ListColorCode,'rgb') || strcmp(colcode.ListColorCode,'bgr');
     3859test3color=strcmp(colcode.ColorCode,'rgb') || strcmp(colcode.ColorCode,'bgr');
    38413860if test3color
    38423861    colcode.ColCode1=str2num(get(handles.num_ColCode1,'String'));
    38433862    colcode.ColCode2=str2num(get(handles.num_ColCode2,'String'));
    38443863end
    3845 % colcode.FixedCbounds=0;
    3846 %colcode.CheckFixVecColor=1;
    38473864vec_C=colcode.MinVec+(colcode.MaxVec-colcode.MinVec)*(0.5:width-0.5)/width;%sample of vec_C values from min to max
    38483865[colorlist,col_vec]=set_col_vec(colcode,vec_C);
     
    46414658    web(helpfile);
    46424659end
    4643 
    4644 
    4645 
    4646 
  • trunk/src/view_field.m

    r402 r405  
    768768
    769769
     770
     771
     772% --- Executes on selection change in ColorCode.
     773function ColorCode_Callback(hObject, eventdata, handles)
     774% hObject    handle to ColorCode (see GCBO)
     775% eventdata  reserved - to be defined in a future version of MATLAB
     776% handles    structure with handles and user data (see GUIDATA)
     777
     778% Hints: contents = cellstr(get(hObject,'String')) returns ColorCode contents as cell array
     779%        contents{get(hObject,'Value')} returns selected item from ColorCode
     780
     781
     782% --- Executes on selection change in ColorScalar.
     783function ColorScalar_Callback(hObject, eventdata, handles)
     784% hObject    handle to ColorScalar (see GCBO)
     785% eventdata  reserved - to be defined in a future version of MATLAB
     786% handles    structure with handles and user data (see GUIDATA)
     787
     788% Hints: contents = cellstr(get(hObject,'String')) returns ColorScalar contents as cell array
     789%        contents{get(hObject,'Value')} returns selected item from ColorScalar
  • trunk/src/write_plot_param.m

    r313 r405  
    5454        set(handles.num_MinVec,'String', num2str(MinC,3));
    5555        set(handles.num_MaxVec,'String',num2str(MaxC,3));
    56         list=get(handles.ListColorCode,'String');
    57         ichoice=get(handles.ListColorCode,'Value');
     56        list=get(handles.ColorCode,'String');
     57        ichoice=get(handles.ColorCode,'Value');
    5858        color_option=list{ichoice};
    5959        test3color=strcmp(color_option,'rgb')||strcmp(color_option,'bgr');
     
    6363            set(handles.Slider1,'Visible','on')
    6464            set(handles.Slider2,'Visible','on')
    65             ColCode1=MinC+(MaxC-MinC)*PlotParam.Vectors.ColCode1;
    66             ColCode2=MinC+(MaxC-MinC)*PlotParam.Vectors.ColCode2;
    67             set(handles.num_ColCode1,'String',num2str(ColCode1,3))
    68             set(handles.num_ColCode2,'String',num2str(ColCode2,3))
    69             set(handles.Slider1,'Value',PlotParam.Vectors.ColCode1)
    70             set(handles.Slider2,'Value',PlotParam.Vectors.ColCode2)
     65            %ColCode1=MinC+(MaxC-MinC)*PlotParam.Vectors.ColCode1;
     66            %ColCode2=MinC+(MaxC-MinC)*PlotParam.Vectors.ColCode2;
     67%             ColCode1=MinC+(MaxC-MinC)*PlotParam.Vectors.ColCode1;
     68            %ColCode2=MinC+(MaxC-MinC)*PlotParam.Vectors.ColCode2;
     69            set(handles.num_ColCode1,'String',num2str(PlotParam.Vectors.ColCode1,3))
     70            set(handles.num_ColCode2,'String',num2str(PlotParam.Vectors.ColCode2,3))
     71            set(handles.Slider1,'Value',(PlotParam.Vectors.ColCode1-MinC)/(MaxC-MinC))
     72            set(handles.Slider2,'Value',(PlotParam.Vectors.ColCode2-MinC)/(MaxC-MinC))
    7173        else
    7274            set(handles.num_ColCode1,'Visible','off')
Note: See TracChangeset for help on using the changeset viewer.