Changeset 89 for trunk/src


Ignore:
Timestamp:
May 20, 2010, 1:48:25 AM (15 years ago)
Author:
sommeria
Message:

many bug corrections and cleaning. Activation of the BW option in uvmat. Improvement of the interaction of get_field with uvmat.

Location:
trunk/src
Files:
27 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/calc_field.m

    r19 r89  
    11%'calc_field': defines fields (velocity, vort, div...) from civx data and calculate them 
    22%---------------------------------------------------------------------
    3 
    43%
    54% OUTPUT:
    65% Scal: matlab vector representing the scalar values (length nbvec defined by var_read) 
    7             % if no input , Scal=list of programmed scalar names (to put in menus)
    8             % if only the sclar name is put as input, vec_A=type of scalar, which can be:
     6%      if no input , Scal=list of programmed scalar names (to put in menus)
     7%      if only the sclar name is put as input, vec_A=type of scalar, which can be:
    98%                   'vel': scalar calculated solely from velocity components
    109%                   'der': needs spatial derivatives     
    1110%                   'var': the scalar name directly corresponds to a field name in the netcdf files
    1211% error: error flag
    13             % error = 0; OK
    14             % error = 1; the prescribed scalar cannot be read or calculated from available fields
     12%      error = 0; OK
     13%      error = 1; the prescribed scalar cannot be read or calculated from available fields
     14%
    1515% INPUT:
    1616% ScalName: string representing the name of the scalar
    1717% DataIn: structure representing the field, as defined in check_field_srtructure.m
    18 
     18%
    1919% FUNCTION related
    2020% varname_generator.m: determines the field names to read in the netcdf file, depending on the scalar
  • trunk/src/cell2tab.m

    r19 r89  
    11%'cell2tab': transform a Matlab cell in a character array suitable for display in a table
     2%------------------------------------------------------------------------
     3% function Tabchar=cell2tab(Tabcell,separator)
     4%
     5% OUTPUT:
     6% Tabchar: character array suitable for table display
     7%
    28% INPUT:
    3 % Tabcell: (nx,ny) cell table, for nx lines
    4 % separator: character used for separating displayed columns
     9% Tabcell: (nx,ny) cell table, for nx lines separator: character used for separating displayed columns
     10
    511function Tabchar=cell2tab(Tabcell,separator)
    612Tabchar={};%default
  • trunk/src/check_field_structure.m

    r38 r89  
    11%'check_field_structure': check the validity of the field struture representation consistant with the netcdf format
    2 %----------------------------------------------------------------------
     2%------------------------------------------------------------------------
    33% function [DataOut,errormsg]=check_field_structure(Data)
    44%
    55% OUTPUT:
    6 %  Data: structure reproducing the input structure Data, with the additional elements:
     6% DataOut: structure reproducing the input structure Data, with the additional elements:
    77%           with fields:
    88%
     
    1313% errormsg: error message which is not empty when the input structure does not have the right form
    1414%
    15 %INPUT:
     15% INPUT:
    1616% Data:   structure containing
    1717%         (optional) .ListGlobalAttribute: cell listing the names of the global attributes
  • trunk/src/check_functions.m

    r42 r89  
    11%'check_functions': check the path and modification date for all the
    2 %  function in the toolbox UVMAT. Called at the opening of uvmat.fig
     2%  function in the toolbox UVMAT. Called at the opening of uvmat
    33%----------------------------------------------------------------------
    44% function [errormsg,date_str]=check_functions
     
    77% errormsg: error message listing functions whose paths are not in the directory of uvmat.m
    88% date_str: date of the most recent modification of a file in the toolbox
    9 %
     9
    1010%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    1111%  Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org.
  • trunk/src/civ.m

    r87 r89  
    181181
    182182% set the range of fields (1:1 by default) and selected pair
    183 if isempty(num2)||isequal(num2,num1)
     183if isnan(num2)||isequal(num2,num1)
    184184    num_ref_i=num1;
    185185else
     
    188188    browse.incr_pair(2)=0;
    189189end
    190 if isempty(num_b)||isequal(num_a,num_b)
    191     if isempty(num_a)
     190if isnan(num_b)||isequal(num_a,num_b)
     191    if isnan(num_a)
    192192        num_ref_j=1;
    193193    else
     
    291291[RootPath,RootFile,str1,str2,str_a,str_b,ext,nom_type,subdir]=name2display(fileinput);
    292292filebase=fullfile(RootPath,RootFile);
    293 num_i1=stra2num(str1);
    294 if isempty(num_i1),num_i1=1;end
    295 num_i2=stra2num(str2);
    296 if isempty(num_i2),num_i2=num_i1;end
     293num_i1=str2double(str1);
     294if isnan(num_i1),num_i1=1;end
     295num_i2=str2double(str2);
     296if isnan(num_i2),num_i2=num_i1;end
    297297num_j1=stra2num(str_a);
    298 if isempty(num_j1),num_j1=1;end
     298if isnan(num_j1),num_j1=1;end
    299299num_j2=stra2num(str_b);
    300 if isempty(num_j2),num_j2=num_j1;end
     300if isnan(num_j2),num_j2=num_j1;end
    301301if isequal(get(handles.compare,'Value'),1)
    302302    browse=[];%initialisation
     
    615615    end
    616616end   
    617    
    618617% no image documentation file found: look for a series of existing images or .nc files
    619618if isempty(time) && ~isequal(ext,'.nc') && ~strcmp(nom_type_ima,'none') && ~strcmp(nom_type_ima,'') && ~strcmp(nom_type_ima,'*')
     
    646645    end
    647646    first_i=max(field_i,1);
    648         %determine the set of times and possible intervals for CIV
     647
     648    if strcmp(nom_type_ima,'_i_j')
     649        field_i=field_count;
     650        field_j=1;
     651        jdetect=1;
     652        while jdetect==1 %look for the maximum file number in the series
     653            imagename=name_generator(filebase,field_i,field_j,ext_ima,nom_type_ima);
     654            jdetect=(exist(imagename,'file')==2);
     655            if jdetect
     656                field_j=field_j+1;
     657            end
     658            %SEE CASE OF NETCDF FILES
     659            %             nbdetect=nbdetect+(exist(imagename,'file')==2);
     660        end
     661        nb_field_j=field_j-1;% last detected field number
     662    end
     663
     664   
     665    %determine the set of times and possible intervals for CIV
    649666 %   dt=(1/1000)*str2num(get(handles.dt,'String'));
    650667    time=[0:nb_field-1]';% time=file index -1  by default
     668    if strcmp(nom_type_ima,'_i_j')
     669       % time=[0:nb_field-1]'*ones(1,nb_field_j);% time=file index -1  by default
     670       time=[0:nb_field-1]'*[0:nb_field_j-1];% time=file index -1  by default
     671    end
     672 
     673
    651674    set(handles.mode,'String',{'series(Di)'})
    652675end
     
    26622685        filename_bat(end-2:end)='bat';
    26632686        fid=fopen(filename_bat,'w');
     2687         
    26642688        fprintf(fid,cmd);
    26652689        fclose(fid);
     
    51525176ref.num_a=stra2num(str_a);
    51535177ref.num_b=stra2num(str_b);
    5154 ref.num1=str2num(field_count);
    5155 ref.num2=str2num(str2);
     5178ref.num1=str2double(field_count);
     5179ref.num2=str2double(str2);
    51565180browse=[];%initialisation
    51575181if ~isequal(ref.ext,'.nc')
     
    52485272set(handles.thresh_vel2,'String','0');
    52495273
    5250 %------------------------------------------------------------------------
    5251 % transform letters to numbers
    5252 function numres=stra2num(str)
    5253 %------------------------------------------------------------------------
    5254 numres=double(str)-96;
    5255 if double(str) >= 48 & double(str) <= 57 % = 1 for numbers
    5256     numres=str2num(str);
    5257 end
     5274% %------------------------------------------------------------------------
     5275% % transform letters to numbers
     5276% function numres=stra2num(str)
     5277% %------------------------------------------------------------------------
     5278% numres=double(str)-96;
     5279% if double(str) >= 48 & double(str) <= 57 % = 1 for numbers
     5280%     numres=str2num(str);
     5281% end
    52585282
    52595283%------------------------------------------------------------------------
  • trunk/src/create_grid.m

    r88 r89  
    11%'create_grid': called by the GUI geometry_calib to create a physical grid
     2%------------------------------------------------------------------------
    23% coord=create_grid(input_grid)
    34%
     
    56% coord: matrix (nbpoint, 3) of coordinates for grid points, with columns x,y,z
    67%
    7 %INPUT:
     8% INPUT:
    89% input_grid (optional): structure to initiate the GUI with fields .x_0,.Dx,.x_1
    910% (defining x coordinates), .y_0,.Dy,.y_1 (defining y coordinates)
  • trunk/src/dataview.m

    r42 r89  
    33% function varargout = series(varargin)
    44% associated with the GUI dataview.fig
    5 %
     5
    66%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    77%  Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org.
  • trunk/src/delete_object.m

    r75 r89  
    11%'delete_object': delete a projection object, defined by its index in the Uvmat list or by its graphic handle
     2%------------------------------------------------------------------------
     3% function delete_object(hObject)
    24%
    3 %INPUT:
     5% INPUT:
    46% hObject: object index (if integer) or handle of the graphic object. If
    5 % hObject is a subobject, the parent object is detected and deleted.
     7%          hObject is a subobject, the parent object is detected and deleted.
    68
    79function delete_object(hObject)
  • trunk/src/editxml.m

    r55 r89  
    66%
    77%INPUT: inputfile:  name of an xml file
    8 %
     8
    99%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    1010%  Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org.
  • trunk/src/find_field_indices.m

    r85 r89  
    11%'find_file_indices': test field structure for input in proj_field and plot_field
    2 %group the variables  into 'fields' with common dimensions
    3 %----------------------------------------------------------------------
     2%    group the variables  into 'fields' with common dimensions
     3%------------------------------------------------------------------------
    44% function [DimVarIndex,CellVarIndex,NbDim,VarType]=find_field_indices(Data)
    55%
    6 %OUTPUT:
     6% OUTPUT:
    77% CellVaxIndex: cell whose elements are arrays of indices in the list data.ListVarName 
    88%              CellvarIndex{i} represents a set of variables with the same dimensions
     
    1818%      .discrete: like scalar, but set of data points without continuity, represented as dots in a usual plot, instead of continuous lines otherwise
    1919%      .scalar: scalar field (default)
    20 %
     20%      .coord: vector of indices of coordinate variables corresponding to matrix dimensions
    2121%   
    22 %INPUT:
     22% INPUT:
    2323% Data: structure representing fields, output of check_field_structure
    2424%            .ListDimName: cell listing the names of the array dimensions
     
    153153        return
    154154    end
    155     NbDim(icell)=0;% nbre of space dimensions
    156     if numel(VarIndex)>1
     155    %NbDim(icell)=0;% nbre of space dimensions
     156    NbDim(icell)=numel(DimCell);
     157    test_coord=0;
     158    if numel(VarIndex)>1     
    157159        if ~isempty(ivar_coord_z)
    158160            NbDim(icell)=3;
     161            test_coord=1;
    159162        elseif ~isempty(ivar_coord_y)
    160163            NbDim(icell)=2;
     164            test_coord=1;
    161165        elseif ~isempty(ivar_coord_x)
    162166            NbDim(icell)=1;
     167            test_coord=1;
    163168        end
    164169    end
    165170    % look at coordinates variables 
    166171    coord=zeros(1,numel(DimCell));%default
    167     if NbDim(icell)==0 && ~isempty(VarDimName)% no unstructured coordinate found
     172%     if NbDim(icell)==0 && ~isempty(VarDimName)% no unstructured coordinate found
     173    if  ~test_coord && ~isempty(VarDimName)
    168174        for idim=1:numel(DimCell)   %loop on the dimensions of the variables in cell #icell
    169175            for ivardim=1:numel(VarDimName)
  • trunk/src/get_field.m

    r59 r89  
    5555% Update handles structure
    5656guidata(hObject, handles);
    57 %pathuvmat=fileparts(which('uvmat'));
    58 %addpath(fullfile(pathuvmat,'FIELD_FCT'))
    59 %loads the information stored in prefdir to initiate the browser and the list of functions
     57
     58%ACTION menu: builtin fcts
    6059menu_str={'PLOT';'FFT';'filter_band';'histogram'}; %list of functions included in 'get_field.m'
    61 nb_builtin=numel(menu_str)-1;
    62 %menu_str(end)=[];%remove from the list the last option 'more...'
    63 path_get_field=fileparts(which('get_field'));%path of the function 'get_field'
     60nb_builtin=numel(menu_str);
     61path_uvmat=fileparts(which('uvmat'));%path of the function 'uvmat'
     62addpath(fullfile(path_uvmat,'get_field'))
     63testexist=zeros(size(menu_str'));%default
    6464for ilist=1:length(menu_str)
    65     fct_path{ilist,1}=fullfile(path_get_field,'get_field');%paths of the fuctions buil-in in 'get_field.m'
    66 end
     65    if exist(menu_str{ilist},'file')
     66        fct_handle{ilist,1}=str2func(menu_str{ilist});
     67        testexist(ilist)=1;
     68    else
     69        fct_handle{ilist,1}=[];
     70        testexist(ilist)=0;
     71    end
     72end
     73rmpath(fullfile(path_uvmat,'get_field'))
     74
    6775dir_perso=prefdir;
    6876profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
     
    7381         for ilist=1:length(h.get_field_fct)
    7482            [path,file]=fileparts(h.get_field_fct{ilist});
    75             fct_path=[fct_path; {path}];%concatene the list of paths
    76             menu_str=[menu_str; {file}];
     83            addpath(path)       
     84            if exist(file,'file')
     85                h_func=str2func(file);
     86                testexist=[testexist 1];
     87             else
     88                h_func=[];
     89                testexist=[testexist 0];
     90             end
     91             fct_handle=[fct_handle; {h_func}]; %concatene the list of paths
     92             rmpath(path)
     93             menu_str=[menu_str; {file}];
    7794         end
    7895     end
    7996end
     97menu_str=menu_str(testexist==1);%=menu_str(testexist~=0)
     98fct_handle=fct_handle(testexist==1);
    8099menu_str=[menu_str;{'more...'}];
    81100set(handles.ACTION,'String',menu_str)
    82 set(handles.ACTION,'UserData',fct_path)% store the list of path in UserData of ACTION 
    83 ACTION_Callback(hObject, eventdata, handles)
     101set(handles.ACTION,'UserData',fct_handle)% store the list of path in UserData of ACTION
     102set(handles.path_action,'String',fullfile(path_uvmat,'get_field'))
     103set(handles.ACTION,'Value',1)% PLOT option selected
    84104set(hObject,'WindowButtonUpFcn',{@mouse_up_gui,handles})%set mouse click action function
    85105if exist('filename','var')& ischar(filename)
    86     set(handles.inputfile,'String',filename)
     106    set(handles.inputfile,'String',filename)% prefill the input file name
     107    set(handles.inputfile,'Enable','off')% desactivate the input file edit box   
     108    set(handles.list_fig,'Value',2)% plotting axes =uvmat selected
     109    set(handles.list_fig,'Visible','off')%
     110    set(handles.RUN,'Visible','off')% RUN button not visible (passive mode, get_field used to define the field for uvamt)
     111    set(handles.MenuOpen,'Visible','off')
     112    set(handles.MenuExport,'Visible','off')
     113    set(handles.MenuHelp,'Visible','off')
    87114    inputfile_Callback(hObject, eventdata, handles)
    88115else
    89116    set(handles.inputfile,'String','')   
    90117end
     118%ACTION_Callback(hObject, eventdata, handles)
    91119if exist('Field','var') & isstruct(Field)
    92120        Field_input(eventdata,handles,Field)
     
    194222    if ~isempty(VarType{imax}.vector_x) && ~isempty(VarType{imax}.vector_y)     
    195223        set(handles.check_vector,'Value',1)
     224        set(handles.check_scalar,'Value',0)
    196225        set(handles.vector_x,'Value',VarType{imax}.vector_x)
    197226        set(handles.vector_y,'Value',VarType{imax}.vector_y)
    198         set(handles.check_scalar,'Value',0)
     227        if ~isempty(VarType{imax}.coord_x) && ~isempty(VarType{imax}.coord_y)
     228            set(handles.coord_x_vectors,'Value',VarType{imax}.coord_x+1)
     229            set(handles.coord_y_vectors,'Value',VarType{imax}.coord_y+1)
     230        end
     231        if ~isempty(VarType{imax}.coord)
     232            set(handles.coord_y_vectors,'Value',VarType{imax}.coord(1)+1)
     233            if numel(VarType{imax}.coord)>=2
     234                set(handles.coord_x_vectors,'Value',VarType{imax}.coord(2)+1)
     235            end
     236        end
    199237    else
    200238        set(handles.check_scalar,'Value',1)
     
    202240        if isfield(VarType{imax},'scalar') && length(VarType{imax}.scalar)>=1
    203241            set(handles.scalar,'Value',VarType{imax}.scalar(1))
     242            if ~isempty(VarType{imax}.coord_x) && ~isempty(VarType{imax}.coord_y)
     243                set(handles.coord_x_scalar,'Value',VarType{imax}.coord_x+1)
     244                set(handles.coord_y_scalar,'Value',VarType{imax}.coord_y+1)
     245            end
     246            if ~isempty(VarType{imax}.coord)
     247                set(handles.coord_y_scalar,'Value',VarType{imax}.coord(1)+1)
     248                if numel(VarType{imax}.coord)>=2
     249                    set(handles.coord_x_scalar,'Value',VarType{imax}.coord(2)+1)
     250                end
     251            end
    204252        end
    205253    end
     
    284332% update_UserData(handles)
    285333
    286 %-------------------------------------------------------
     334%------------------------------------------------------------------------
    287335% --- Executes on selection change in scalar menu.
    288336function scalar_Callback(hObject, eventdata, handles)
    289 %-------------------------------------------------------
     337%------------------------------------------------------------------------
    290338Aindex=get(handles.scalar,'Value');
    291339Astring=get(handles.scalar,'String');
     
    293341update_field(hObject, eventdata, handles,VarName)
    294342
    295 %-------------------------------------------------------
     343%------------------------------------------------------------------------
    296344% --- Executes on selection change in coord_x_scalar.
    297345function coord_x_scalar_Callback(hObject, eventdata, handles)
    298 %-------------------------------------------------------
     346%------------------------------------------------------------------------
    299347index=get(handles.coord_x_scalar,'Value');
    300348string=get(handles.coord_x_scalar,'String');
     
    302350update_field(hObject, eventdata, handles,VarName)
    303351
    304 %-------------------------------------------------------
     352%------------------------------------------------------------------------
    305353% --- Executes on selection change in coord_y_scalar.
    306354function coord_y_scalar_Callback(hObject, eventdata, handles)
    307 %-------------------------------------------------------
     355%------------------------------------------------------------------------
    308356index=get(handles.coord_y_scalar,'Value');
    309357string=get(handles.coord_y_scalar,'String');
     
    311359update_field(hObject, eventdata, handles,VarName)
    312360
    313 %-------------------------------------------------------
     361%------------------------------------------------------------------------
    314362% --- Executes on selection change in coord_z_scalar.
    315363function coord_z_scalar_Callback(hObject, eventdata, handles)
    316 %-------------------------------------------------------
     364%------------------------------------------------------------------------
    317365index=get(handles.coord_z_scalar,'Value');
    318366string=get(handles.coord_z_scalar,'String');
     
    320368update_field(hObject, eventdata, handles,VarName)
    321369
    322 %-------------------------------------------------------
     370%------------------------------------------------------------------------
    323371% --- Executes on selection change in vector_x.
    324372function vector_x_Callback(hObject, eventdata, handles)
    325 %-------------------------------------------------------
     373%------------------------------------------------------------------------
    326374index=get(handles.vector_x,'Value');
    327375string=get(handles.vector_x,'String');
     
    329377update_field(hObject, eventdata, handles,VarName)
    330378
    331 %-------------------------------------------------------
     379%------------------------------------------------------------------------
    332380% --- Executes on selection change in vector_y.
    333381function vector_y_Callback(hObject, eventdata, handles)
    334 %-------------------------------------------------------
     382%------------------------------------------------------------------------
    335383index=get(handles.vector_y,'Value');
    336384string=get(handles.vector_y,'String');
     
    338386update_field(hObject, eventdata, handles,VarName)
    339387
    340 %-------------------------------------------------------
     388%------------------------------------------------------------------------
    341389% --- Executes on selection change in vector_z.
    342390function vector_z_Callback(hObject, eventdata, handles)
    343 %-------------------------------------------------------
     391%------------------------------------------------------------------------
    344392index=get(handles.vector_z,'Value');
    345393string=get(handles.vector_z,'String');
     
    347395update_field(hObject, eventdata, handles,VarName)
    348396
    349 %-------------------------------------------------------
     397%------------------------------------------------------------------------
    350398% --- Executes on selection change in coord_x_vectors.
    351399function coord_x_vectors_Callback(hObject, eventdata, handles)
    352 %-------------------------------------------------------
     400%------------------------------------------------------------------------
    353401index=get(handles.coord_x_vectors,'Value');
    354402string=get(handles.coord_x_vectors,'String');
     
    736784function RUN_Callback(hObject, eventdata, handles)
    737785%---------------------------------------------------------
    738 path_get_field=fileparts(which('get_field'));
    739 list=get(handles.ACTION,'String');
     786%path_get_field=fileparts(which('get_field'));
     787%list=get(handles.ACTION,'String');
    740788index=get(handles.ACTION,'Value');
    741 ACTION=list{index};
    742 list_path=get(handles.ACTION,'UserData');
    743 %hselect_field=get(handles.inputfile,'parent');%handle of the get_field interface
    744 fct_path=list_path{index}; %path stored for the function ACTION
    745 if ~isequal(fct_path,path_get_field)
    746 %     eval(['spath=which(''' action ''');']) %spath = current path of the selected function ACTION
    747 %     if ~isequal(spath,fct_path)& exist(fct_path,'dir')
    748         addpath(fct_path)% add the prescribed path if not the current one
    749 %     end
    750 end
    751 % fct_path
    752 eval(['h_fun=@' ACTION ';'])
    753 if ~isequal(fct_path,path_get_field)
    754         rmpath(fct_path)% add the prescribed path if not the current one   
    755 end
    756 
     789% ACTION=list{index};
     790list_func=get(handles.ACTION,'UserData');
     791h_fun=list_func{index};
     792% %hselect_field=get(handles.inputfile,'parent');%handle of the get_field interface
     793% fct_path=list_path{index}; %path stored for the function ACTION
     794% if ~isequal(fct_path,path_get_field)
     795%     addpath(fct_path)% add the prescribed path if not the current one
     796% end
     797% eval(['h_fun=@' ACTION ';'])
     798% if ~isequal(fct_path,path_get_field)
     799%      rmpath(fct_path)% add the prescribed path if not the current one   
     800% end
    757801set(handles.RUN,'BackgroundColor',[0.831 0.816 0.784])
    758802drawnow
    759 h_fun(handles.figure1);%handles.figure1 =handles of the GUI get_field
     803SubField=h_fun(handles.figure1);%handles.figure1 =handles of the GUI get_field
     804if ~isempty(SubField)
     805    plot_get_field(SubField,handles)
     806end
    760807browse_fig(handles.list_fig); %update the list of new existing figures
    761808
     809%------------------------------------------------------------------------
     810function plot_get_field(SubField,handles)
     811%------------------------------------------------------------------------
     812list_fig=get(handles.list_fig,'String');
     813val=get(handles.list_fig,'Value');
     814if strcmp(list_fig{val},'uvmat')
     815    set(handles.figure1,'Name','uvmat_field')
     816    set(handles.inputfile,'Enable','off')% desactivate the input file edit box   
     817%     set(handles.list_fig,'Visible','off')%
     818    set(handles.RUN,'Visible','off')% RUN button not visible (passive mode, get_field used to define the field for uvamt)
     819    set(handles.MenuOpen,'Visible','off')
     820    set(handles.MenuExport,'Visible','off')
     821    uvmat(get(handles.inputfile,'String'))
     822else
     823    hfig=str2num(list_fig{val});% chosen figure number from tyhe GUI
     824    if isempty(hfig)
     825        hfig=figure;
     826        list_fig=[list_fig;num2str(hfig)];
     827        set(handles.list_fig,'String',list_fig);
     828        haxes=axes;
     829    else
     830        figure(hfig);
     831    end
     832    haxes=findobj(hfig,'Type','axes');
     833    plot_field(SubField,haxes)
     834end
    762835
    763836%------------------------------------------------
     
    10381111if isequal(val,0)
    10391112    set(handles.PanelScalar,'Visible','off')
    1040 %      set(handles.scalar,'Visible','off')
    1041 %     set(handles.ordinate,'Max',2.0)%allow multiple ordinate input option
    1042 %     if isequal(get(handles.check_vector,'Value'),0);
    1043 %         set(handles.coord_z_vectors_scalar,'Visible','off')
    1044 %     end
    10451113else
    10461114    set(handles.PanelScalar,'Visible','on')
    1047 %     set(handles.scalar,'Visible','on')
    1048 %     val=get(handles.ordinate,'Value');
    1049 %     val=val(1);
    1050 %     set(handles.ordinate,'Value',val);%suppress multiple ordinates
    1051 %     set(handles.ordinate,'Max',1.0);%suppress multiple ordinate input option
    1052 %       set(handles.coord_z_vectors_scalar,'Visible','on')
    10531115end
    10541116
     
    10621124    set(handles.PanelVectors,'Visible','on')
    10631125end
    1064 
    1065 
    10661126
    10671127%-----------------------------
     
    10881148index_ACTION=get(handles.ACTION,'Value');% selected string index
    10891149ACTION= list_ACTION{index_ACTION}; % selected string
    1090 path_get_field=which('get_field');%path to series.m
    1091 list_path=get(handles.ACTION,'UserData');
    1092 
    1093 % nb_builtin=0;
    1094 % if iscell(list_path)
    1095 %     for ilist=1:length(list_path)
    1096 %         if isequal(list_path{ilist},path_get_field)
    1097 %             nb_builtin=nb_builtin+1;
    1098 %         else
    1099 %             break
    1100 %         end
    1101 %     end
    1102 % end
    1103 % if nb_builtin==0% the path to get_field has been changed, reinitialize
    1104 %     get_field_OpeningFcn(hObject, eventdata, handles)
    1105 %     return
    1106 % end
    1107 
     1150list_func_handles=get(handles.ACTION,'UserData');% get list of function handles (full address of the function, including name and path)
     1151ff=functions(list_func_handles{end});
    11081152% add a new function to the menu
    11091153if isequal(ACTION,'more...')
    1110     pathfct=fileparts(path_get_field);
    1111     browse_name=fullfile(path_get_field,'FIELD_FCT');
    1112     if length(list_path)>nb_builtin
    1113         browse_name=list_path{end};% initialize browser with  the path of the last introduced function
    1114     end
     1154%     pathfct=fileparts(path_get_field);
     1155%     browse_name=fullfile(path_get_field,'FIELD_FCT');
     1156%     if length(list_path)>nb_builtin
     1157%         browse_name=list_path{end};% initialize browser with  the path of the last introduced function
     1158%     end
    11151159    [FileName, PathName] = uigetfile( ...
    11161160       {'*.m', ' (*.m)';
    11171161        '*.m',  '.m files '; ...
    11181162        '*.*', 'All Files (*.*)'}, ...
    1119         'Pick a file',browse_name);
     1163        'Pick a file',ff.file);
    11201164    if length(FileName)<2
    11211165        return
     
    11261170        return
    11271171    end
    1128 %     ACTION=FileName(1:end-2);% ACTION choice updated by the selected item 
     1172
    11291173    % insert the choice in the action menu
    11301174   menu_str=update_menu(handles.ACTION,ACTION);%new action menu in which the new item has been appended if needed
    11311175   index_ACTION=get(handles.ACTION,'Value');% currently selected index in the list
    1132    list_path{index_ACTION}=PathName;
     1176   addpath(PathName)
     1177   list_func_handles{index_ACTION}=str2func(ACTION);% create the function handle corresponding to the newly seleced function
     1178   set(handles.ACTION,'UserData',list_func_handles)
     1179   set(handles.path_action,'enable','inactive')% indicate that the current path is accessible (not 'off')
     1180   %list_path{index_ACTION}=PathName;
    11331181   if length(menu_str)>nb_builtin+5;
    11341182       nbremove=length(menu_str)-nb_builtin-5;
    11351183       menu_str(nb_builtin+1:end-5)=[];
    1136        list_path(nb_builtin+1:end-4)=[];
     1184       list_func_handles(nb_builtin+1:end-4)=[];
    11371185       index_ACTION=index_ACTION-nbremove;
    11381186       set(handles.ACTION,'Value',index_ACTION)
    11391187       set(handles.ACTION,'String',menu_str)
    1140    end
    1141    list_path{index_ACTION}=PathName;
    1142    set(handles.ACTION,'UserData',list_path);
    1143    set(handles.path_action,'enable','inactive')% indicate that the current path is accessible (not 'off')
    1144    
     1188   end   
    11451189   %record the current menu in personal file profil_perso
    11461190   dir_perso=prefdir;
    11471191   profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    11481192   for ilist=nb_builtin+1:length(menu_str)-1
    1149        get_field_fct{ilist-nb_builtin}=fullfile(list_path{ilist},[menu_str{ilist} '.m']);
     1193       ff=functions(list_func_handles{ilist});
     1194       get_field_fct{ilist-nb_builtin}=ff.file;
    11501195   end
    11511196   if exist(profil_perso,'file')
     
    11631208end
    11641209
    1165    %check the current path to the selected function
    1166 PathName=list_path{index_ACTION};%current recorded path
    1167 % if ~isequal(path_get_field,PathName)
    1168 %     CurrentPath=fileparts(which(ACTION));
    1169 %     if ~isequal(CurrentPath,PathName)%&&~isequal(CurrentPath,fullfile(PathName,'private'))
    1170 %         addpath(PathName)
    1171 %         errormsg=check_functions;
    1172 %         msgbox_uvmat('CONFIRMATION',[['path ' PathName ' added to the current Matlab pathes'];errormsg])
    1173 %     end
    1174 % end
    1175 set(handles.path_action,'String',PathName); %show the path to the senlected function
    1176    
    1177    
    1178 %     fct_name=fullfile(PathName, FileName);
    1179 %     if ~exist(fct_name,'file')
    1180 %            msgbox_uvmat('ERROR',['procesing fct ' fct_name ' not found'])
    1181 %     else
    1182 %        ACTION=FileName(1:end-2);%
    1183 %        menu=update_menu(handles.ACTION,ACTION);%add the selected fct to the menu
    1184 %        index_ACTION=get(handles.ACTION,'Value');% selected string index
    1185 %        list_path{index_ACTION}=PathName;
    1186 %        set(handles.ACTION,'UserData',list_path)
    1187 %        if exist(profil_perso,'file')
    1188 %             save (profil_perso,'coord_fct','-append'); %store the root name for future opening of uvmat
    1189 %         end
    1190 %     end   
    1191 %     
    1192 %     
    1193 %     fileinput=FileName;%complete file name
    1194 %     eval(['spath=which(''' FileName ''');'])% current path to the function FileName
    1195 %     if ~isequal(spath,PathName)
    1196 %         addpath(PathName)
    1197 %     end
    1198 %     FileName([end-1:end])=[];
    1199 %     
    1200 %    % insert the choice in the action menu
    1201 %     nbACTION=length(list_ACTION);
    1202 %     index=0;
    1203 %     for ilist=1:nbACTION
    1204 %        if isequal(FileName,list_ACTION{ilist})%look for the selected scalar in the fields_input menu
    1205 %             index=ilist;%
    1206 %        end
    1207 %     end
    1208 %     if index==0
    1209 %        list_ACTION{nbACTION}=FileName; %put the chosen fct at the penultimate place in the fields_input menu
    1210 %        list_path{nbACTION}=PathName;
    1211 %        index=nbACTION;
    1212 %        list_ACTION{nbACTION+1}='more...';
    1213 %        set(handles.ACTION,'String',list_ACTION)
    1214 %     end
    1215 %     set(handles.ACTION,'Value',index);% store the selected scalar type
    1216 %     set(handles.ACTION,'UserData',list_path);
    1217 %     usr_defined_fct=fct_name;
    1218 %     nbmenu=length(list_ACTION);
    1219 %     nbadd=nbmenu-5;
    1220 %     ilist=0;
    1221 %     for imenu=nbmenu-min(4,nbadd):nbmenu-1
    1222 %       ilist=ilist+1;
    1223 %       fct_get_field{ilist,1}=list_ACTION{imenu};
    1224 %       fct_path_get_field{ilist}=list_path{imenu};
    1225 %     end
    1226 %     if exist(profil_perso,'file')
    1227 %         save(profil_perso,'usr_defined_fct','fct_get_field','fct_path_get_field','-append')
    1228 %     else
    1229 %        save(profil_perso,'usr_defined_fct','fct_get_field','fct_path_get_field','-V6')
    1230 %     end
    1231 % end
    1232 
    1233 % %check the current path to the selected function
    1234 % list_path
    1235 % PathName=list_path{index_ACTION}
    1236 % CurrentPath=fileparts(which(ACTION))
    1237 % if ~isequal(PathName,CurrentPath)
    1238 %     addpath(PathName)
    1239 %     errormsg=check_functions;
    1240 %     msgbox_uvmat('WARNING',[['path ' PathName ' added to the current Matlab pathes'];errormsg])
    1241 % end
    1242 % set(handles.path_action,'String',fullfile(PathName,' ')); %show the path to the senlected function
    1243 
    1244 %default setting for the visibility of the GUI elements*
    1245 if ~isequal(ACTION,'PLOT')
    1246     varargout=feval(ACTION);% input list asked by the selected function
    1247     test_1Dplot=[];
    1248     test_scalar=[];
    1249     test_vector=[];
    1250     for ilist=1:length(varargout)
    1251         switch varargout{ilist,1}
     1210%check the current path to the selected function
     1211h_fun=list_func_handles{index_ACTION};
     1212if isa(h_fun,'function_handle')
     1213    func=functions(h_fun);
     1214    set(handles.path_action,'String',fileparts(func.file)); %show the path to the senlected function
     1215    GUI_input=h_fun();%handles.figure1 =handles of the GUI get_field
     1216else
     1217    set(handles.path_action,'String','')
     1218    msgbox_uvmat('ERROR','unknown path to ACTION function, reload it')
     1219    return
     1220end
     1221
     1222%prepare the GUI options for the selected ACTION
     1223test_1Dplot=0;
     1224test_scalar=0;
     1225test_vector=0;
     1226if iscell(GUI_input)
     1227    for ilist=1:length(GUI_input)
     1228        switch GUI_input{ilist}
    12521229                           %RootFile always visible
    12531230            case 'check_1Dplot'   
    1254                  test_1Dplot=isequal(lower(varargout{ilist,2}),'y');
     1231                 test_1Dplot=1;
    12551232            case 'check_scalar'
    1256                  test_scalar=isequal(lower(varargout{ilist,2}),'y');   
     1233                 test_scalar=1;   
    12571234            case 'check_vector'   
    1258                  test_vector=isequal(lower(varargout{ilist,2}),'y');
     1235                 test_vector=1;
    12591236        end
    12601237    end
    1261     if test_1Dplot==0
    1262         set(handles.check_1Dplot,'Value',0);
    1263     end
    1264     if test_1Dplot==1
    1265         set(handles.check_1Dplot,'Value',1);
    1266     end
    1267     if test_scalar==0
    1268         set(handles.check_scalar,'Value',0);
    1269     end
    1270     if test_scalar==1
    1271         set(handles.check_scalar,'Value',1);
    1272     end
    1273     if test_vector==0
    1274         set(handles.check_vector,'Value',0);
    1275     end
    1276     if test_vector==1
    1277         set(handles.check_vector,'Value',1);
    1278     end
    1279     check_1Dplot_Callback(hObject, eventdata, handles)
    1280     check_scalar_Callback(hObject, eventdata, handles)
    1281     check_vector_Callback(hObject, eventdata, handles)
    1282 end
     1238end
     1239set(handles.check_1Dplot,'Value',test_1Dplot);
     1240set(handles.check_scalar,'Value',test_scalar);
     1241set(handles.check_vector,'Value',test_vector);
     1242check_1Dplot_Callback(hObject, eventdata, handles)
     1243check_scalar_Callback(hObject, eventdata, handles)
     1244check_vector_Callback(hObject, eventdata, handles)
     1245
    12831246
    12841247%-----------------------------------------------------
     
    14631426end
    14641427
    1465 % %store input file in personal file uvmat_perso.mat
    1466 % dir_perso=prefdir;
    1467 % profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    1468 % if exist(profil_perso,'file')
    1469 %     save (profil_perso,'RootPath','SubDir','RootFile','NomType', 'ext','-append'); %store the root name for future opening of uvmat
    1470 % else
    1471 %    save (profil_perso,'RootPath','SubDir','RootFile','NomType', 'ext'); %store the root name for future opening of uvmat
    1472 % end   
    1473 
    1474 
    14751428% --------------------------------------------------------------------
    14761429function MenuFile_1_Callback(hObject, eventdata, handles)
  • trunk/src/get_field/FFT.m

    r36 r89  
    33%requests for the visibility of input windows in the GUI series  (activated directly by the selection in the menu ACTION)
    44if ~exist('hget_field','var')
    5     GUI_input={'check_1Dplot','y';...%
    6         'check_scalar','n';... %
    7         'check_vector','n'... %
    8                };
     5    GUI_input={'check_1Dplot'};
    96    return %exit the function
    107end
  • trunk/src/get_field/PLOT.m

    r80 r89  
    11%---------------------------------------------------------
    22% --- Executes on button press in RUN.
    3 function PLOT(hget_field)
     3function SubField=PLOT(hget_field)
    44%---------------------------------------------------------
     5SubField=[]; %default
     6if ~exist('hget_field','var')
     7    return
     8end
    59[SubField,errormsg]=read_get_field(hget_field);
    610if ~isempty(errormsg)
    711    msgbox_uvmat('ERROR',['error in read_get_field/PLOT input:' errormsg])
    8     return
    912end
    10 handles=guidata(hget_field);
    11 list_fig=get(handles.list_fig,'String');
    12 val=get(handles.list_fig,'Value');
    13 if strcmp(list_fig{val},'uvmat')
    14     uvmat(SubField)
    15 else
    16     hfig=str2num(list_fig{val});% chosen figure number from tyhe GUI
    17     if isempty(hfig)
    18         hfig=figure;
    19         list_fig=[list_fig;num2str(hfig)];
    20         set(handles.list_fig,'String',list_fig);
    21         haxes=axes;
    22     else
    23         figure(hfig);
    24     end
    25     haxes=findobj(hfig,'Type','axes');
    26     plot_field(SubField,haxes)
    27 end
  • trunk/src/imadoc2struct.m

    r81 r89  
    11%'imadoc2struct': reads the xml file for image documentation
     2%------------------------------------------------------------------------
     3% function [s,errormsg]=imadoc2struct(ImaDoc)
    24%
    3 %function [s,errormsg]=imadoc2struct(ImaDoc)
    4 %--------------------------------------------------------
    55% OUTPUT:
    66% s: structure representing ImaDoc
     
    1313% INPUT:
    1414% ImaDoc: full name of the xml input file with head key ImaDoc
    15 %function [s,error,Heading,nom_type_ima,ext_ima,abs_time,TimeUnit,mode,NbSlice]=imadoc2struct(ImaDoc)
     15
    1616function [s,errormsg]=imadoc2struct(ImaDoc)
    1717
  • trunk/src/mouse_up.m

    r82 r89  
    11%'mouse_up': function  activated when the mouse button is released
    2 %----------------------------------------------------------------
     2%------------------------------------------------------------------------
    33% function mouse_up(hObject,eventdata,handles)
    44% activated by the command:
    55% set(hObject,'WindowButtonUpFcn',{'mouse_up'}),
    66% where hObject is the handle of the figure
    7 %
    8 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
     7
     8%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    99%  Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org.
    10 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
     10%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    1111%     This file is part of the toolbox UVMAT.
    1212%
     
    2020%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2121%     GNU General Public License (file UVMAT/COPYING.txt) for more details.
    22 %AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
     22%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    2323
    2424function mouse_up(hObject,eventdata,handles)
     
    344344    end
    345345    if ((nbselect==0) && isequal(get(currentobj,'Type'),'axes')) || isequal(currentobj,huvmat)
    346         global CurData
    347         CurData=get(currentobj,'UserData');
     346        global Data_uvmat
     347        Data_uvmat=get(currentobj,'UserData');
    348348        %plot_text(CurData)
    349349        %get_field([],CurData);
    350         evalin('base','global CurData')%make CurData global in the workspace
     350        evalin('base','global Data_uvmat')%make CurData global in the workspace
    351351        objtype=get(currentobj,'Type');
    352352        display(['UserData of ' objtype ':'])
    353         evalin('base','CurData') %display CurData in the workspace
     353        evalin('base','Data_uvmat') %display CurData in the workspace
    354354        commandwindow %brings the Matlab command window to the front
    355355    end
  • trunk/src/name_generator.m

    r85 r89  
    11%'name_generator': creates a file name from a root name and indices.
    2 %---------------------------------------------------------------------
     2%------------------------------------------------------------------------
    33% [filename,idetect,num_i1_out,num_j1_out,num_i2_out,num_j2_out,subdir_out]=...
    44%        name_generator(filebase,num_i1,num_j1,ext,nom_type,comp_input,num_i2,num_j2,subdir);
    5 %---------------------------------------------------------------------           
     5%------------------------------------------------------------------------           
    66% This function detects the existence the constructed file name and it can
    77% find indices according to file existence if they are not specified
    88% rmq: this function is related to the reverse functions display2name and name2diplay
    9 %---------------------------------------------------------------------
     9%------------------------------------------------------------------------
    1010% OUTPUT:
    1111% filename: string representing the file name (including path)
     
    1313% num_i1_out,num_j1_out,num_i2_out,num_j2_out,subdir_out: index numbers and subdirectory detected
    1414%            for free input (= to the corresponding input indices when comp_input=1)
    15 %---------------------------------------------------------------------
     15%------------------------------------------------------------------------
    1616% INPUT:
    1717% 'filebase': the root name,
     
    2222%       nom_type='': constant name [filebase ext] (default output if 'nom_type' is undefined)
    2323%       nom_type='*': the same  file [filebase ext] contains successive fields (ex avi movies)
     24%       nom_type='%03d' or '%04d', series of indexed images with numbers completed with zeros to 3 or 4 digits, e.g.'aa045.tif'
    2425%       nom_type='_i': series of files with a single index i preceded by '_'(e.g. 'aa_45.png').
     26%       nom_type='_%03d', '_%04d', or '_%05d', series of indexed images with _ and numbers completed with zeros to 3, 4 or 5 digits, e.g.'aa_045.tif'
    2527%       nom_type='#' series of indexed images wich is not series_i [filebase index ext], e.g. 'aa045.jpg' or 'aa45.tif'
    2628%       nom_type='_i_j' matrix of files with two indices i and j separated by '_'(e.g. 'aa_45_2.png')
     
    2830%       nom_type='_i_j1-j2'pairs of j indices (e.g. 'aa_45_2-3.nc')
    2931%       nom_type='_i1-i2_j' pairs of i indices (e.g. 'aa_45-46_2.nc')
     32%       nom_type='%3da','%3dA' with a numerical index and an index letter(e.g.'aa045b.png'),
    3033%       nom_type='#a','#A' with a numerical index and an index letter(e.g.'aa045b.png'), OBSOLETE (replaced by 'series_i_j')
    31 %       nom_type='%03d' or '%04d', series of indexed images with numbers completed with zeros to 3 or 4 digits, e.g.'aa045.tif'
    32 %       nom_type='_%03d', '_%04d', or '_%05d', series of indexed images with _ and numbers completed with zeros to 3, 4 or 5 digits, e.g.'aa_045.tif'
    33 %       nom_type='raw_SMD', same as '#a' but with no extension ext='', OBSOLETE
    34 %       nom_type='#_ab' from pairs of '#a' images (e.g. 'aa045bc.nc'), ext='.nc', OBSOLETE (replaced by 'netc_2D')
    35 %       nom_type='%3dab' from pairs of '%3da' images (e.g. 'aa045bc.nc'), ext='.nc', OBSOLETE (replaced by 'netc_2D')
     34%       nom_type='#_ab' from pairs of '#a' images (e.g. 'aa045bc.nc'),
     35%       nom_type='%3d_ab' from pairs of '%3da' images (e.g. 'aa045bc.nc')
    3636%'comp_input' (for nom_type involving index pairs (e.g. netc))
    3737%       comp_input=1: the index pair is imposed,
     
    4848sizf=size(filebase);
    4949if (~ischar(filebase)||~isequal(sizf(1),1)),filebase='';end
     50if ~exist('ext','var')
     51    ext='';
     52end
     53if ~exist('nom_type','var')
     54    nom_type='';
     55end
    5056if ~ischar(ext),ext='';end
    51 % filename=[filebase ext];%default
    5257idetect=0;
    53 if ~exist('num_i1','var') || isequal(num_i1,[])
     58if ~exist('num_i1','var') || isempty(num_i1) || isnan(num_i1)
    5459    num_i1=1; %default
    5560end
    56 if ~exist('num_j1','var') || isequal(num_j1,[])
     61if ~exist('num_j1','var') ||  isempty(num_j1) || isnan(num_j1)
    5762    num_j1=1; %default
    5863end
    59 if ~exist('num_i2','var') || isequal(num_i2,[])
     64if ~exist('num_i2','var') ||  isempty(num_i2) || isnan(num_i2)
    6065    num_i2=num_i1; %default
    6166end
    62 if ~exist('num_j2','var') || isequal(num_i2,[])
     67if ~exist('num_j2','var') || isempty(num_j2) || isnan(num_j2)
    6368    num_j2=num_j1; %default
    6469end
     
    7176num_j2_out=num_j2;%default output
    7277
    73 test_pairs=isequal(nom_type,'netc_old')| isequal(nom_type,'netc_2D') | isequal(nom_type,'netc_3D')| isequal(nom_type,'_i1-i2_j1-j2')| ...
    74   isequal(nom_type,'netc_series')| isequal(nom_type,'#_ab')| isequal(nom_type,'_i_j1-j2')| isequal(nom_type,'_i1-i2_j')| isequal(nom_type,'_i1-i2');
    75 test_2D= isequal(nom_type,'netc_old') |isequal(nom_type,'netc_2D')|isequal(nom_type,'#_ab') |isequal(nom_type,'_i_j1-j2');
    76 test_3D=isequal(nom_type,'netc_3D') |isequal(nom_type,'netc_series')| isequal(nom_type,'_i1-i2_j')| isequal(nom_type,'_i1-i2');
    77 if isequal(nom_type,'series_i')| isequal(nom_type,'_i');
     78test_pairs=strcmp(nom_type,'netc_old')| strcmp(nom_type,'netc_2D') | strcmp(nom_type,'netc_3D')| strcmp(nom_type,'_i1-i2_j1-j2')| ...
     79  strcmp(nom_type,'netc_series')| strcmp(nom_type,'#_ab')| strcmp(nom_type,'_i_j1-j2')| strcmp(nom_type,'_i1-i2_j')| strcmp(nom_type,'_i1-i2');
     80test_2D= strcmp(nom_type,'netc_old') |strcmp(nom_type,'netc_2D')|strcmp(nom_type,'#_ab') |strcmp(nom_type,'_i_j1-j2');
     81test_3D=strcmp(nom_type,'netc_3D') |strcmp(nom_type,'netc_series')| strcmp(nom_type,'_i1-i2_j')| strcmp(nom_type,'_i1-i2');
     82if strcmp(nom_type,'series_i')| strcmp(nom_type,'_i');
    7883        filename=[filebase '_' num2str(num_i1) ext];
    7984        num_i2_out=num_i1;
    8085        num_j1_out=[];
    8186        num_j2_out=[];
    82 elseif length(nom_type)==5 && isequal(nom_type(1:3),'_%0')&& isequal(nom_type(5),'d');
     87elseif length(nom_type)==5 && strcmp(nom_type(1:3),'_%0')&& strcmp(nom_type(5),'d');
    8388        filename=[filebase '_' num2str(num_i1,nom_type(2:5)) ext];
    8489        num_i2_out=num_i1;
    8590        num_j2_out=num_j1;
    86 elseif isequal(nom_type,'series_i_j')| isequal(nom_type,'_i_j')
     91elseif strcmp(nom_type,'series_i_j')| strcmp(nom_type,'_i_j')
    8792        filename=[filebase '_' num2str(num_i1) '_' num2str(num_j1) ext];
    8893        num_i2_out=num_i1;
    8994        num_j2_out=num_j1;
    90 elseif isequal(nom_type,'png_old')| isequal(nom_type,'#a')| isequal(nom_type,'#A')
     95elseif strcmp(nom_type,'png_old')| strcmp(nom_type,'#a')| strcmp(nom_type,'#A')
    9196        filename=[filebase num2str(num_i1,'%03d') num2stra(num_j1,nom_type) ext];
    9297        num_i2_out=num_i1;
    9398        num_j2_out=num_j1;
    94 elseif  length(nom_type)>=5 & isequal(nom_type(2:3),'%0') & isequal(nom_type(5),'d')  %isequal(nom_type,'_%04dA') %camera PCO Toulouse
     99elseif  length(nom_type)>=5 & strcmp(nom_type(2:3),'%0') & strcmp(nom_type(5),'d')  %strcmp(nom_type,'_%04dA') %camera PCO Toulouse
    95100        filename=[filebase nom_type(1) num2str(num_i1,nom_type(2:4)) num2stra(num_j1,nom_type) ext];
    96101        num_i2_out=num_i1;
    97102        num_j2_out=num_j1;   
    98 elseif isequal(nom_type,'raw_SMD') %suffix a, b, c without extension
     103elseif strcmp(nom_type,'raw_SMD') %suffix a, b, c without extension
    99104        filename=[filebase num2str(num_i1,'%03d') num2stra(num_j1,nom_type)];
    100105        num_i2_out=num_i1;
    101106        num_j2_out=num_j1;
    102 elseif isequal(nom_type,'ima_num')| isequal(nom_type,'#')
     107elseif strcmp(nom_type,'ima_num')| strcmp(nom_type,'#')
    103108        filename=[filebase num2str(num_i1) ext];
    104109        num_i2_out=num_i1;
    105110        num_j1_out=[];
    106111        num_j2_out=[];
    107 elseif length(nom_type)>=4 & isequal(nom_type(1:2),'%0') & isequal(nom_type(end),'d')
     112elseif length(nom_type)>=4 & strcmp(nom_type(1:2),'%0') & strcmp(nom_type(end),'d')
    108113        filename=[filebase num2str(num_i1,nom_type) ext]; %test number with a 0 before
    109114        num_i2_out=num_i1;
     
    115120    filebasesub=filebase;
    116121    % get the root name filebasesub for the netcdf files
    117     if  ~isequal(subdir,'') && ~isequal(subdir,'?')
     122    if  ~strcmp(subdir,'') && ~strcmp(subdir,'?')
    118123            [Path,Name]=fileparts(filebase);
    119124            filebasesub=fullfile(Path,subdir,Name);
    120125    end
    121126     %inexistant pair if num_i2=0 or num_j2=0
    122 %     if isequal(num_i2,0)
     127%     if strcmp(num_i2,0)
    123128%         filename=[filebasesub '*-*_' num2str(num_i1) ext];
    124129%         return
    125130%     end
    126 %     if isequal(num_j2,0)
     131%     if strcmp(num_j2,0)
    127132%         filename=[filebasesub '_' num2str(num_i1) '_*-*' ext];
    128133%         return
     
    232237if ~isequal(subdir,'?'), subdir_out=subdir; else, subdir_out='';end;
    233238
    234 %---------------------------------------------------------------
    235 % search the appropriate image pair (netcdf file) corresponding to a given
    236 % image number
    237 %-------------------------------------------------------------------
     239%------------------------------------------------------------------------
     240% --- search the appropriate image pair (netcdf file) corresponding to a given image number
    238241function [filename,num_i1,num_j1,num_i2,num_j2,idetect]=search_pair(filebasesub,num_i1,num_j1,num_i2,nom_type)
     242%------------------------------------------------------------------------
    239243% for nom_type=netc_2D or netc_old, it searches all the pairs corresponding
    240244% to num_i1, and chooses the most recent file.
  • trunk/src/nc2struct.m

    r56 r89  
    1616%                    .DimValue= vlalues of dimensions (added information, not requested for field description)
    1717%                    .VarDimIndex= list of dimension indices (added information,
    18 
     18%
    1919%INPUT:
    2020%     nc:      name of a netcdf file (char string) or netcdf object   
  • trunk/src/plot_field.m

    r88 r89  
    3131%    The only variable attribute used for plotting purpose is .Role which can take
    3232%    the values
    33         %       Role = 'scalar':  (default) represents a scalar field
    34         %            = 'coord_x', 'coord_y',  'coord_z': represents a separate set of
    35         %                        unstructured coordinate x, y  or z
    36         %            = 'vector': represents a vector field whose number of components
    37         %                is given by the last dimension (called 'nb_dim')
    38         %            = 'vector_x', 'vector_y', 'vector_z'  :represents the x, y or z  component of a vector 
    39         %            = 'warnflag' : provides a warning flag about the quality of data in a 'Field', default=0, no warning
    40         %            = 'errorflag': provides an error flag marking false data,
    41         %                   default=0, no error. Different non zero values can represent different criteria of elimination.
    42 
    43 
     33%       Role = 'scalar':  (default) represents a scalar field
     34%            = 'coord_x', 'coord_y',  'coord_z': represents a separate set of
     35%                        unstructured coordinate x, y  or z
     36%            = 'vector': represents a vector field whose number of components
     37%                is given by the last dimension (called 'nb_dim')
     38%            = 'vector_x', 'vector_y', 'vector_z'  :represents the x, y or z  component of a vector 
     39%            = 'warnflag' : provides a warning flag about the quality of data in a 'Field', default=0, no warning
     40%            = 'errorflag': provides an error flag marking false data,
     41%                   default=0, no error. Different non zero values can represent different criteria of elimination.
     42%
     43%
    4444%         additional elements characterizing the projection object (should not be necessary)--
    4545%            Data.Style : style of projection object
     
    8484% PosColorbar: if not empty, display a colorbar for B&W images
    8585%               imposed position of the colorbar (ex [0.821 0.471 0.019 0.445])
    86 %
     86
    8787%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
    8888%  Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org.
     
    141141if testnewfig% create a new figure and axes if the plotting axes does not exist
    142142    hfig=figure;
    143     if isfield(Data,'IndexObj')&isfield(Data,'Style')&isfield(Data,'ProjMode')
     143    if isfield(Data,'IndexObj') && isfield(Data,'Style') && isfield(Data,'ProjMode')
    144144        figname=[num2str(Data.IndexObj) '-' Data.Style];
    145145        set(hfig,'Name',figname)
    146146    end
    147     testhandle=0;
    148     if isfield(PlotParam,'text_display_1')& ishandle(PlotParam.text_display_1)
     147%     testhandle=0;
     148    if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1)
    149149        set(hfig,'UserData',PlotParam)
    150         testhandle=1;
     150%         testhandle=1;
    151151    end
    152152    set(hfig,'Units','normalized')
     
    160160    hstack=findobj(allchild(0),'Type','figure');%current stack order of figures in matlab
    161161end
    162 if isfield(PlotParam,'text_display_1')& ishandle(PlotParam.text_display_1)
     162if isfield(PlotParam,'text_display_1') && ishandle(PlotParam.text_display_1)
    163163    PlotParam=read_plot_param(PlotParam);   
    164164end
     
    171171
    172172% check the cells of fields :
    173 testnbdim=1;
     173% testnbdim=1;
    174174[CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(Data);
    175175
     
    180180end
    181181if ~isfield(Data,'NbDim') %& ~isfield(Data,'Style')%determine the space dimensionb if not defined: choose the kind of plot
    182     [Data.NbDim,imax]=max(NbDim);
     182    [Data.NbDim]=max(NbDim);
    183183end
    184184if isequal(Data.NbDim,0)
     
    207207    msgbox_uvmat('ERROR','volume plot not implemented yet')
    208208    return
    209 else
    210     testnbdim=0;
     209% else
     210%     testnbdim=0;
    211211end
    212212
     
    239239function hdisplay=plot_text(FieldData,hdisplay_in)
    240240%-------------------------------------------------------------------
    241 if exist('hdisplay_in','var') & ishandle(hdisplay_in) & isequal(get(hdisplay_in,'Type'),'uicontrol')
     241if exist('hdisplay_in','var') && ishandle(hdisplay_in) && isequal(get(hdisplay_in,'Type'),'uicontrol')
    242242    hdisplay=hdisplay_in;
    243243else
     
    254254    sizss=size(ss);
    255255    if isnumeric(ss)
    256         if sizss(1)<=1 & length(ss)<5
     256        if sizss(1)<=1 && length(ss)<5
    257257            displ{icell}=num2str(ss);
    258258        else
     
    263263    elseif iscell(ss)
    264264        sizcell=size(ss);
    265         if sizcell(1)==1 & length(sizcell)==2 %line cell
     265        if sizcell(1)==1 && length(sizcell)==2 %line cell
    266266           ssline='{''';
    267267           for icolumn=1:sizcell(2)
    268268               if isnumeric(ss{icolumn})
    269                    if size(ss{icolumn},1)<=1 & length(ss{icolumn})<5
     269                   if size(ss{icolumn},1)<=1 && length(ss{icolumn})<5
    270270                      sscolumn=num2str(ss{icolumn});%line vector
    271271                   else
     
    321321plotstr='hhh=plot(';
    322322textmean={};
    323 abscissa_name='';
     323% abscissa_name='';
    324324coord_x_index=[];
    325325test_newplot=1;
    326326hh=findobj(haxes,'tag','plot_line');
    327 num_curve=numel(hh);
     327% num_curve=numel(hh);
    328328icurve=0;
    329329for icell=1:length(CellVarIndex)
     
    351351    testcoordvar=0;
    352352    charplot_0='''-''';%default
    353     if isfield(data,'ObjectProjMode')& isequal(data.ObjectProjMode,'projection')
     353    if isfield(data,'ObjectProjMode')&& isequal(data.ObjectProjMode,'projection')
    354354        charplot_0='+';
    355355    end
     
    374374        VarAttribute=data.VarAttribute;
    375375        for ivar=1:length(VarIndex)
    376              if length(VarAttribute)>=VarIndex(ivar) & isfield(VarAttribute{VarIndex(ivar)},'long_name')
     376             if length(VarAttribute)>=VarIndex(ivar) && isfield(VarAttribute{VarIndex(ivar)},'long_name')
    377377                 plotname{VarIndex(ivar)}=VarAttribute{VarIndex(ivar)}.long_name;
    378378             else
     
    461461        else
    462462            legend_old=get(hlegend,'String');
    463             if isequal(size(legend_old,1),size(legend_str,1))&~isequal(legend_old,legend_str)
     463            if isequal(size(legend_old,1),size(legend_str,1))&&~isequal(legend_old,legend_str)
    464464                set(hlegend,'String',[legend_old legend_str]);
    465465            end
     
    537537y_units='';
    538538for icell=1:length(CellVarIndex) % length(CellVarIndex) =1 or 2 (from the calling function)
    539 %     VarIndex=CellVarIndex{icell};
    540539    VarType=VarTypeCell{icell};
    541540    ivar_X=VarType.coord_x; % defines (unique) index for the variable representing unstructured x coordinate (default =[])
     
    564563            eval(['vec_U=Data.' Data.ListVarName{ivar_U} ';'])
    565564            eval(['vec_V=Data.' Data.ListVarName{ivar_V} ';'])
     565            'TESTplot'
     566            VarType.coord
    566567            if ~isempty(ivar_X) && ~isempty(ivar_Y)% 2D field (with unstructured coordinates or structured ones (then ivar_X and ivar_Y empty)     
    567568                eval(['vec_X=Data.' Data.ListVarName{ivar_X} ';'])
     
    614615            [A,AX,AY]=proj_grid(AX',AY',A',[],[],'np>256');  % interpolate on a grid 
    615616            if isfield(Data,'VarAttribute')
    616                 if numel(Data.VarAttribute)>=ivar_X & isfield(Data.VarAttribute{ivar_X},'units')
     617                if numel(Data.VarAttribute)>=ivar_X && isfield(Data.VarAttribute{ivar_X},'units')
    617618                    x_units=['(' Data.VarAttribute{ivar_X}.units ')'];
    618619                end
    619                 if numel(Data.VarAttribute)>=ivar_Y & isfield(Data.VarAttribute{ivar_Y},'units')
     620                if numel(Data.VarAttribute)>=ivar_Y && isfield(Data.VarAttribute{ivar_Y},'units')
    620621                    y_units=['(' Data.VarAttribute{ivar_Y}.units ')'];
    621622                end
     
    629630            test_interp_Y=0; %default, regularly meshed Y coordinate
    630631            if isfield(Data,'VarAttribute')
    631                 if numel(Data.VarAttribute)>=VarType.coord(2) & isfield(Data.VarAttribute{VarType.coord(2)},'units')
     632                if numel(Data.VarAttribute)>=VarType.coord(2) && isfield(Data.VarAttribute{VarType.coord(2)},'units')
    632633                    x_units=['(' Data.VarAttribute{VarType.coord(2)}.units ')'];
    633634                end
     
    714715    end
    715716    %set the color map
     717    if isfield(PlotParam.Scalar,'BW')
     718        BW=PlotParam.Scalar.BW; %test for BW gray scale images
     719    else
     720        BW=(siz==2) && (isa(A,'uint8')|| isa(A,'uint16'));% non color images represented in gray scale by default
     721    end
    716722    if siz==2 %for black and white images
    717723        if ~isfield(PlotParam.Scalar,'AutoScal')
     
    729735            MinA=PlotParam.Scalar.MinA; 
    730736        end;
    731         if isequal(PlotParam.Scalar.AutoScal,0)|isempty(PlotParam.Scalar.MaxA)|~isa(PlotParam.Scalar.MaxA,'double') %correct if there is no numerical data in edit box
     737        if isequal(PlotParam.Scalar.AutoScal,0)||isempty(PlotParam.Scalar.MaxA)||~isa(PlotParam.Scalar.MaxA,'double') %correct if there is no numerical data in edit box
    732738            MaxA=double(max(max(A)));
    733739        else
     
    756762            contmin=intercont*floor(min(min(B))/intercont);
    757763            contmax=intercont*ceil(max(max(B))/intercont);
    758             cont_pos_plus=[0:intercont:contmax];
    759             cont_pos_min=[double(contmin):intercont:-intercont];
     764            cont_pos_plus=0:intercont:contmax;
     765            cont_pos_min=double(contmin):intercont:-intercont;
    760766            cont_pos=[cont_pos_min cont_pos_plus];
    761767            sizpx=(AX(end)-AX(1))/(np(2)-1);
    762768            sizpy=(AY(1)-AY(end))/(np(1)-1);
    763769            x_cont=[AX(1):sizpx:AX(end)]; % pixel x coordinates for image display
    764             y_cont=[AY(1):-sizpy:AY(end)]; % pixel x coordinates for image display
     770            y_cont=AY(1):-sizpy:AY(end); % pixel x coordinates for image display
    765771            txt=ver;%version of Matlab
    766772            Release=txt(1).Release;
     
    783789            colormap(map);
    784790        end
    785         if ~isequal(PlotParam.Scalar.Contours,1)       
     791        if ~isequal(PlotParam.Scalar.Contours,1) 
    786792            % rescale the grey levels with min and max, put a grey scale colorbar
    787             if (isfield(PlotParam.Scalar,'BW')& (isequal(PlotParam.Scalar.BW,1))|isa(A,'uint8')| isa(A,'uint16'))%images
     793            if BW
    788794                B=A;
    789795                vec=linspace(0,1,255);%define a linear greyscale colormap
     
    797803    else %color images
    798804        axes(haxes)
    799         B=uint8(A);
     805        if BW
     806            B=uint16(sum(A,3));
     807        else
     808            B=uint8(A);
     809        end
    800810        MinA=0;
    801811        MaxA=255;
     
    846856    test_ima=1;
    847857    %display the colorbar code for B/W images if Poscolorbar not empty
    848     if siz==2 & exist('PosColorbar','var')& ~isempty(PosColorbar)
     858    if siz==2 && exist('PosColorbar','var')&& ~isempty(PosColorbar)
    849859        if isempty(hcol)|~ishandle(hcol)
    850860             hcol=colorbar;%create new colorbar
     
    966976        dy_thresh=max(abs(diffy))/2;
    967977        ind_jump=find(abs(diffy) > dy_thresh); %indices with diff(vec_Y)> max/2, detect change of line
    968         ind_sel=[1:ind_jump(1)];%select the first line
     978        ind_sel=1:ind_jump(1);%select the first line
    969979        for i=2:2:length(ind_jump)-1
    970980            ind_sel=[ind_sel [ind_jump(i)+1:ind_jump(i+1)]];% select the odd lines
     
    11911201    siz=size(ind);
    11921202    if siz(2)<4%if there are less than 4 selected values (4 levels)
    1193         values=[-9:0.5*div:9];
     1203        values=-9:0.5*div:9;
    11941204        ind=find((ord*values-MaxA)<0 & (ord*values-MinA)>0);
    11951205    end
  • trunk/src/read_get_field.m

    r81 r89  
    666666            end
    667667        end
    668         if empty_coord_vec_x       
    669                 coord_x_name=DimCell{2};
    670                 SubField.ListVarName=[{coord_x_name} SubField.ListVarName];
    671                 SubField.VarDimName=[{coord_x_name} SubField.VarDimName]; 
    672                 if testold
    673                     eval(['SubField.' coord_x_name '=linspace(Coord_2(1),Coord_2(end),npxy(2));'])
    674                 else
    675                     eval(['SubField.' coord_x_name '=[0.5 npxy(2)-0.5];'])
    676                 end
     668        if empty_coord_vec_x
     669            if numel(DimCell)<2 
     670                errormsg='undefined x coordinate';
     671                return
     672            end
     673            coord_x_name=DimCell{2};
     674            SubField.ListVarName=[{coord_x_name} SubField.ListVarName];
     675            SubField.VarDimName=[{coord_x_name} SubField.VarDimName]; 
     676            if testold
     677                eval(['SubField.' coord_x_name '=linspace(Coord_2(1),Coord_2(end),npxy(2));'])
     678            else
     679                eval(['SubField.' coord_x_name '=[0.5 npxy(2)-0.5];'])
     680            end
    677681           
    678682            if ~testold
  • trunk/src/series.m

    r76 r89  
    430430update_file(hObject, eventdata, handles,fileinput,1)
    431431
    432 % --------------------------------------------------------------------
    433 % refresh the GUI data after introduction of a new file series
     432%------------------------------------------------------------------------
     433% ---  refresh the GUI data after introduction of a new file series
    434434function update_file(hObject, eventdata, handles,fileinput,addtest)
    435 %hseries=get(handles.RootPath,'parent'); 
     435%------------------------------------------------------------------------ 
    436436if ~exist(fileinput,'file')
    437437    msgbox_uvmat('ERROR',['input file ' fileinput  ' does not exist'])
    438438    return
    439439end
    440 hseries=handles.figure1;
     440
    441441% refresh input root name, indices, file extension and nomenclature
    442442[RootPath,RootFile,field_count,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(fileinput);
     443
    443444%check for movie image files
    444445if ~isempty(FileExt)
    445 if ~isempty(imformats(FileExt(2:end)))
    446     imainfo=imfinfo(fileinput);     
    447     if length(imainfo) >1 %case of image with multiple frames
    448         NomType='*';
    449         [RootPath,RootFile]=fileparts(fileinput);
    450     end
    451 end
     446    if ~isempty(imformats(FileExt(2:end)))
     447        imainfo=imfinfo(fileinput);
     448        if length(imainfo) >1 %case of image with multiple frames
     449            NomType='*';
     450            [RootPath,RootFile]=fileparts(fileinput);
     451        end
     452    end
    452453end
    453454NcType='none';%default
     
    467468set(handles.nb_field2,'Value',1)
    468469if addtest
    469     SeriesData=get(hseries,'UserData');
     470    SeriesData=get(handles.figure1,'UserData');
    470471    SeriesData.displ_num=[0 0 0 0;SeriesData.displ_num];
    471472    SeriesData.CurrentInputFile_1=SeriesData.CurrentInputFile;
     
    520521set(handles.first_j,'String',num2str(ref_j))
    521522set(handles.last_j,'String',num2str(ref_j));
    522 %set(hseries,'UserData',SeriesData);
    523523
    524524%enable other menus and uicontrols
     
    544544FileBase=fullfile(RootPath,RootFile);
    545545
    546 % nb_field{icell,1}='?';%default
    547 % nb_field2{icell,1}='?';%default
    548546testima=0; %test for image input
    549547if isequal(lower(FileExt),'.avi') %.avi file
     
    681679    [error,XmlData.Time,TimeUnit,mode,npx,npy,pxcmx,pxcmy]=read_imatext([FileBase '.civ']);
    682680    time=XmlData.Time;
    683     size(time)
    684     GeometryCalib.R=[pxcmx 0 0; 0 pxcmy 0;0 0 0];
    685     GeometryCalib.Tx=0;
    686     GeometryCalib.Ty=0;
    687     GeometryCalib.Tz=1;
    688     GeometryCalib.dpx=1;
    689     GeometryCalib.dpy=1;
    690     GeometryCalib.sx=1;
    691     GeometryCalib.Cx=0;
    692     GeometryCalib.Cy=0;
    693     GeometryCalib.f=1;
    694     GeometryCalib.kappa1=0;
    695     GeometryCalib.CoordUnit='cm';
    696     XmlData.GeometryCalib=GeometryCalib;
    697681    if error==2, warntext=['no file ' FileBase '.civ'];
    698682    elseif error==1, warntext='inconsistent number of fields in the .civ file';
     
    705689end
    706690
    707 if ~isempty(time)
    708     siztime=size(time);
    709     nb_field=siztime(1);
    710     nb_field2=siztime(2);
    711 end   
     691
     692% if ~isempty(time)
     693%     siztime=size(time);
     694%     nb_field=siztime(1);
     695%     nb_field2=siztime(2);
     696% end   
    712697set(handles.TimeUnit,'String',TimeUnit)
     698%look for max indices
     699if ~strcmp(NomType,'*')
     700    [num_i1,num_i2,num_j1,num_j2]=find_indexseries(fileinput);
     701    nb_field=max(floor((max(num_i1)+max(num_i2))/2));
     702    nb_field2=max(floor((max(num_j1)+max(num_j2))/2));
     703end
    713704if isempty(nb_field)
    714705    nb_field_str='?';
     
    727718set(handles.nb_field,'String',nb_field_cell);
    728719set(handles.nb_field2,'String',nb_field2_cell);
    729 set(hseries,'UserData',SeriesData);
     720set(handles.figure1,'UserData',SeriesData);
    730721
    731722%number of slices
     
    743734NomType_Callback(hObject, eventdata, handles)
    744735
     736%store the root name for future opening of uvmat
    745737dir_perso=prefdir;
    746738profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    747 % save(profil_perso, 'FileBase'); %store the root name for future opening of uvmat
    748739if exist(profil_perso,'file')
    749740    save (profil_perso,'RootPath','SubDir','RootFile','NomType', '-append'); %store the root name for future opening of uvmat
     
    839830NomType_Callback(hObject, eventdata, handles)
    840831
     832%------------------------------------------------------------------------
    841833function NomType_Callback(hObject, eventdata, handles)
     834%------------------------------------------------------------------------
    842835hseries=get(handles.ProjObject,'Parent');
    843836SeriesData=get(hseries,'UserData');
     
    897890                state_j='on';
    898891    end
    899 end  
     892end
    900893if testpair
    901894    mode_Callback(hObject, eventdata, handles) 
    902895else
    903896    set(handles.NomType,'String',NomTypeCell)
    904 end
    905 set(handles.first_j,'Visible',state_j)
    906 set(handles.incr_j,'Visible',state_j)
    907 set(handles.last_j,'Visible',state_j)
    908 set(handles.nb_field2,'Visible',state_j)
     897    set(handles.first_j,'Visible',state_j)
     898    set(handles.incr_j,'Visible',state_j)
     899    set(handles.last_j,'Visible',state_j)
     900    set(handles.nb_field2,'Visible',state_j)
     901end
     902
    909903
    910904%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%????????????
     
    926920    test_find_pair=isequal(NomType,'_i_j1-j2')|| isequal(NomType,'_i1-i2_j')|| isequal(NomType,'_i1-i2')|| isequal(NomType,'#_ab');
    927921end
    928 % displ_num=[];%default
    929 % first_i=str2num(get(handles.first_i,'String'));
    930 % last_i=str2num(get(handles.last_i,'String'));
    931922time=[];
    932923if isfield(SeriesData,'Time')
     
    939930if isequal(mode,'bursts')
    940931    enable_i(handles,'On')
    941     enable_j(handles,'Off')   
     932    enable_j(handles,'Off') %do not display j index scanning in burst mode (j is fixed by the burst choice) 
    942933elseif  isequal(NomType,'_i_j1-j2')|| isequal(NomType,'_i1-i2_j')
    943934    enable_i(handles,'On')
    944     enable_j(handles,'On')
     935    enable_j(handles,'On') % allow both i and j index scanning
    945936else
    946937    enable_i(handles,'On')
     
    993984
    994985%--------------------------------------------------------------
    995 % determine the menu for civ1 pairs depending on existing netcdf file at the middle of
    996 % the field series set by first_i, incr, last_i
     986% determine the menu for civ1 pairs depending on existing netcdf files
     987% with the reference indices ref_i and ref_j
    997988%----------------------------------------------------------------
    998989function find_netcpair_civ(hObject, eventdata, handles,Val)
     
    10871078                displ_num(4,ind_exist)=0;
    10881079                %[cte_detect,vdt,cte_read]=read_netcdf(filename,{'dt','dt2','absolut_time_T0','absolute_time_TO_2'});
    1089                 [Cte,var_detect,ichoice]=nc2struct(nc,{});
     1080                [Cte,var_detect,ichoice]=nc2struct(filename,{});
    10901081                if isfield(Cte,'dt2')
    10911082                    dt=Cte.dt2;
     
    13571348end
    13581349Series.hseries=handles.figure1; % handles to the series GUI
    1359 % if isequal(get(handles.ParamVal,'Visible'),'on')
    1360 %     ParamKey=get(handles.ParamKey,'String');
    1361 %     if ischar(ParamKey)
    1362 %         ParamKey{1}=ParamKey;
    1363 %     end
    1364 %     ParamString=get(handles.ParamVal,'String');
    1365 %     if ischar(ParamString)
    1366 %         for ilist=1:size(ParamString,1)
    1367 %             ParamVal{ilist}=ParamString(ilist,:);
    1368 %         end
    1369 %     else
    1370 %         ParamVal=ParamString;
    1371 %     end   
    1372 % end
    13731350
    13741351%read the set of field numbers
     
    14331410    %case of pairs (.nc files)
    14341411   
    1435     if isequal(NomType{iview},'_i_j1-j2')| isequal(NomType{iview},'_i1-i2_j')| isequal(NomType{iview},'_i1-i2')| isequal(NomType{iview},'#_ab')
     1412    if isequal(NomType{iview},'_i_j1-j2')|| isequal(NomType{iview},'_i1-i2_j')|| isequal(NomType{iview},'_i1-i2')|| isequal(NomType{iview},'#_ab')
    14361413        ind_shift=SeriesData.displ_num(iview,:);
    14371414        if isequal(ind_shift,[0 0 0 0]) % undefined pairs
     
    19281905        end
    19291906
    1930 %----------------------------------------------------
    1931 %  determine the list of index pairs of processing file
    1932 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
     1907%------------------------------------------------------------------------
     1908% --- determine the list of index pairs of processing file
    19331909function [num_i1,num_i2,num_j1,num_j2,num_i_out,num_j_out]=find_file_indices(num_i,num_j,ind_shift,NomType,mode)
     1910%------------------------------------------------------------------------
    19341911num_i1=num_i;% set of first image numbers by default
    19351912num_i2=num_i;
     
    19381915num_i_out=num_i;
    19391916num_j_out=num_j;
    1940 if isequal (NomType,'_i1-i2_j') |isequal (NomType,'_i1-i2')
     1917if isequal (NomType,'_i1-i2_j') || isequal (NomType,'_i1-i2')
    19411918    num_i1_line=num_i+ind_shift(3);% set of first image numbers
    19421919    num_i2_line=num_i+ind_shift(4);
     
    22112188set(handles.path_transform,'String',fileparts(func.file)); %show the path to the senlected function
    22122189
    2213 %-------------------------------------------------------------
    2214 %generates a series of file names with reference numbers between range1 and
    2215 %range2 with increment incr. The reference number num_ref is the image number at the middle of the
    2216 %image pair. The set of first numbers num1 of the image pairs is also
    2217 %given as output
    2218 %------------------------------------------------------
     2190%------------------------------------------------------------------------
     2191% --- generates a series of file names with reference numbers between range1 and
     2192% --- range2 with increment incr. The reference number num_ref is the image number at the middle of the
     2193% --- image pair. The set of first numbers num1 of the image pairs is also
     2194% --- given as output
    22192195function [num_i1,num_i2,num_j1,num_j2,nbmissing]=netseries_generator(filebase,subdir,mode,first_i,incr_i,last_i,first_j,incr_j,last_j)
     2196%------------------------------------------------------------------------
    22202197[Path,Name]=fileparts(filebase);
    22212198filebasesub=fullfile(Path,subdir,Name);
     
    22362213    dirpair=dir([filebasesub '_*-*_*.nc']);
    22372214else
    2238     errordlg('option *|* not yet implemented')
     2215    msgbox_uvmat('ERROR','option *|* not yet implemented')
    22392216    return
    22402217end
    22412218if isempty(dirpair)
    2242         errordlg('no pair detected in the selected range')
     2219        msgbox_uvmat('ERROR','no pair detected in the selected range')
    22432220        return
    22442221end
    2245     %ind0_i=first_i:incr_i:last_i;
    2246     %nbcolumn=length(ind0_i);
    2247     %dirpair=dir([filebasesub '_*_*-*.nc']);
    2248 if isequal(mode,'bursts')|isequal(mode,'#_ab')
     2222
     2223if isequal(mode,'bursts')||isequal(mode,'#_ab')
    22492224    icount=0;
    22502225    for ifile=1:length(dirpair)
    22512226        [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name);
    2252        
    2253 %         if isempty(str2num(str_1))
    2254 %             dirpair(ifile).name
    2255 %         end
    22562227        num1_r=str2num(str_1);
    22572228        if isequal(RootFile,Name) & ~isempty(num1_r)   
     
    22592230            num_a(ifile)=stra2num(str_a);
    22602231            num_b(ifile)=stra2num(str_b);
    2261 %             icount=icount+1;
    22622232        end     
    22632233    end
    2264     length(dirpair)
    2265 %     num_j=floor((num_a+num_b)/2); %list of reference indices of the detected files
    22662234    test_range= (num_i1 >=first_i)&(num_i1<= last_i);% =1 when both numbers are in the range
    22672235    ind_i=((num_i1-first_i)/incr_i)+1;%indices i in the list of prescribed file indices
     
    23092277    num_i1_r=num_i1_r(select);
    23102278    num_i2_r=num_i2_r(select);
    2311 %     num_j=num_j(select);
    23122279    dirpair=dirpair(select);
    23132280    [ind_remove]=find_pairs(dirpair,ind_ij,nbcolumn*nbline) ;
     
    23252292    nbmissing=nbline*nbcolumn-length(ind_ij);
    23262293elseif isequal(mode,'series(Dj)')
    2327  %   ind0_i=first_i:incr_i:last_i;
    2328  %   nbcolumn=length(ind0_i);
    2329  %   ind0_j=first_j:incr_j:last_j;
    2330   %  nbline=length(ind0_j);
    2331   %  dirpair=dir([filebasesub '_*_*-*.nc']);
    23322294    for ifile=1:length(dirpair)
    23332295        [RootPath,RootFile,str_1,str_2,str_a,str_b,ext,nom_type]=name2display(dirpair(ifile).name);
     
    23622324    num_i2=num_i1;
    23632325    nbmissing=nbline*nbcolumn-length(ind_ij);
    2364 %     for i=1:length(indsel);%A SUPPRIMER ULTERIEUREMENT
    2365 %         if indsel(i)==0
    2366 %             filecell{i}='';
    2367 %         else
    2368 %             Name=dirpair(indsel(i)).name;
    2369 %             filecell{i}=fullfile(Path,subdir,Name);
    2370 %         end
    2371 %     end
    2372 %else
    2373 %    errordlg('option *|* not yet implemented')
    2374 %    return
    2375 end
    2376 
    2377 function path_transform_Callback(hObject, eventdata, handles)
    2378 % hObject    handle to path_transform (see GCBO)
    2379 % eventdata  reserved - to be defined in a future version of MATLAB
    2380 % handles    structure with handles and user data (see GUIDATA)
    2381 
    2382 % Hints: get(hObject,'String') returns contents of path_transform as text
    2383 %        str2double(get(hObject,'String')) returns contents of path_transform as a double
    2384 
    2385 
    2386 % --- Executes during object creation, after setting all properties.
    2387 function path_transform_CreateFcn(hObject, eventdata, handles)
    2388 % hObject    handle to path_transform (see GCBO)
    2389 % eventdata  reserved - to be defined in a future version of MATLAB
    2390 % handles    empty - handles not created until after all CreateFcns called
    2391 
    2392 % Hint: edit controls usually have a white background on Windows.
    2393 %       See ISPC and COMPUTER.
    2394 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    2395     set(hObject,'BackgroundColor','white');
    2396 end
    2397 
    2398 
     2326end
     2327
     2328%------------------------------------------------------------------------
     2329% --- generates series of file indices corresponding to a file fileinput
     2330function [num_i1,num_i2,num_j1,num_j2]=find_indexseries(fileinput)
     2331%------------------------------------------------------------------------
     2332num_i1=NaN;%default
     2333num_i2=NaN;%default
     2334num_j1=NaN;%default
     2335num_j2=NaN;%default
     2336% refresh input root name, indices, file extension and nomenclature
     2337[RootPath,RootFile,field_count,str2,str_a,str_b,FileExt,NomType,SubDir]=name2display(fileinput);
     2338if strcmp(SubDir,'')
     2339    filebasesub=fullfile(RootPath,RootFile);
     2340else
     2341    filebasesub=fullfile(RootPath,SubDir,RootFile);
     2342end
     2343dirpair=[]; %default
     2344switch NomType
     2345    case '_i'
     2346        dirpair=dir([filebasesub '_*' FileExt]);
     2347    case '_i_j'
     2348        dirpair=dir([filebasesub '_*_*' FileExt]);
     2349    case '_i1-i2'
     2350        dirpair=dir([filebasesub '_*-*' FileExt]);
     2351    case '#_ab'
     2352        dirpair=dir([filebasesub '*_*' FileExt]);
     2353    case '_i_j1-j2'
     2354        dirpair=dir([filebasesub '*_*-*' FileExt]);   
     2355    case '_i1-i2_j'
     2356        dirpair=dir([filebasesub '*-*_*' FileExt]);   
     2357end
     2358%       nom_type='#' series of indexed images wich is not series_i
     2359%       [filebase index ext], e.g. 'aa045.jpg' or 'aa45.tif'
     2360%       nom_type='#a','#A' with a numerical index and an index letter(e.g.'aa045b.png'), OBSOLETE (replaced by 'series_i_j')
     2361%       nom_type='%03d' or '%04d', series of indexed images with numbers completed with zeros to 3 or 4 digits, e.g.'aa045.tif'
     2362%       nom_type='_%03d', '_%04d', or '_%05d', series of indexed images with _ and numbers completed with zeros to 3, 4 or 5 digits, e.g.'aa_045.tif'
     2363%       nom_type='raw_SMD', same as '#a' but with no extension ext='', OBSOLETE
     2364%       nom_type='#_ab' from pairs of '#a' images (e.g. 'aa045bc.nc'), ext='.nc', OBSOLETE (replaced by 'netc_2D')
     2365%       nom_type='%3dab' from pairs of '%3da' images (e.g. 'aa045bc.nc'), ext='.nc', OBSOLETE (replaced by 'netc_2D')
     2366for ifile=1:length(dirpair)
     2367    [RootPath,RF,str_1,str_2,str_a,str_b]=name2display(dirpair(ifile).name);
     2368    num_i1(ifile)=str2double(str_1);
     2369    num_i2(ifile)=str2double(str_2);
     2370    if isnan(num_i2(ifile))
     2371        num_i2(ifile)=num_i1(ifile);
     2372    end
     2373    num_j1(ifile)=stra2num(str_a);
     2374    if isnan(num_j1(ifile))
     2375        num_j1(ifile)=1;
     2376    end
     2377    num_j2(ifile)=stra2num(str_b);
     2378    if isnan(num_j2(ifile))
     2379        num_j2(ifile)=num_j1(ifile);
     2380    end
     2381end
     2382
  • trunk/src/series/merge_proj.m

    r78 r89  
    1 function GUI_input=merge_proj(num_i1,num_i2,num_j1,num_j2,Series);
     1function GUI_input=merge_proj(num_i1,num_i2,num_j1,num_j2,Series)
    22
    33%requests for the visibility of input windows in the GUI series  (activated directly by the selection in the menu ACTION)
     
    6565    if ~isequal(hhh,'')&& mmreader.isPlatformSupported()
    6666        if isequal(lower(FileExt{iview}),'.avi')
    67             MovieObject{iview}=mmreader(fullfile(RootPath{iview},[RootFile{iview} FileExt{iview}]));
     67            MovieObject{iview}=mmreader(fullfile(Series.RootPath{iview},[Series.RootFile{iview} Series.FileExt{iview}]));
    6868            test_movie(iview)=1;
    6969        end
     
    117117%check coincidence in time
    118118multitime=0;
    119 if length(timecell)==0
     119if isempty(timecell)
    120120    time=[];
    121121elseif length(timecell)==1
     
    160160if isequal(FieldName,'get_field...')
    161161    hget_field=findobj(allchild(0),'Name','get_field');%find the get_field... GUI
    162    % hhget_field=guidata(hget_field);%handles of GUI elements in get_field
    163162    SubField=get_field('read_get_field',hObject,eventdata,hget_field); %read the names of the variables to plot in the get_field GUI
    164 %     if isequal(get(hhget_field.menu_coord,'Visible'),'on')
    165 %         list_transform=get(hhget_field.menu_coord,'String');
    166 %         val_list=get(hhget_field.menu_coord,'Value');
    167 %         transform=list_transform{val_list};
    168 %     end
    169163end
    170164%detect whether all the files are 'images' or 'netcdf'
     
    176170for iview=1:nbview
    177171     ext=FileExt{iview};
    178      form=imformats(ext([2:end]));
     172     form=imformats(ext(2:end));
    179173     if isequal(lower(ext),'.vol')
    180174         testvol=testvol+1;
     
    286280                Field{iview}=transform_fct(Field{iview},XmlData{iview});%transform to phys if requested
    287281            end
     282            min(Field{iview}.X)
    288283            if testcivx
    289284                    Field{iview}=calc_field(FieldName,Field{iview});
    290285            end
     286            min(Field{iview}.X)
    291287
    292288            %projection on object (gridded plane)
     
    386382        error=1;
    387383    end
    388 %      if ~isequal(MergeData.VarDimIndex,Data{iview}.VarDimIndex)
    389 %         error=1;
    390 %      end
    391384end
    392385if error
     
    394387    return
    395388end
     389
     390%group the variables (fields of 'FieldData') in cells of variables with the same dimensions
     391[CellVarIndex,NbDim,VarTypeCell]=find_field_indices(Data{1});
     392%LOOP ON GROUPS OF VARIABLES SHARING THE SAME DIMENSIONS
     393% CellVarIndex=cells of variable index arrays
     394ivar_new=0; % index of the current variable in the projected field
     395icoord=0;
     396for icell=1:length(CellVarIndex)
     397    if NbDim(icell)==1
     398        continue
     399    end
     400    VarIndex=CellVarIndex{icell};%  indices of the selected variables in the list FieldData.ListVarName
     401    VarType=VarTypeCell{icell};
     402    ivar_X=VarType.coord_x;
     403    ivar_Y=VarType.coord_y;
     404    ivar_FF=VarType.errorflag;
     405    if isempty(ivar_X)
     406        test_grid=1;%test for input data on regular grid (e.g. image)coordinates
     407    else
     408        if length(ivar_Y)~=1
     409                msgbox_uvmat('ERROR','y coordinate missing in proj_field.m')
     410                return
     411        end
     412        test_grid=0;
     413    end
     414%    DimIndices=Data{1}.VarDimIndex{VarIndex(1)};%indices of the dimensions of the first variable (common to all variables in the cell)
     415    %case of input fields with unstructured coordinates
     416    if ~test_grid
     417        for ivar=VarIndex
     418            VarName=MergeData.ListVarName{ivar};
     419            for iview=1:nbview
     420                eval(['MergeData.' VarName '=[MergeData.' VarName '; Data{iview}.' VarName '];'])
     421            end
     422        end
     423    %case of fields defined on a structured  grid
     424    else 
     425%        DimValue=MergeData.DimValue(DimIndices);%set of dimension values
     426        testFF=0;
     427        for iview=2:nbview
     428%             if ~isequal(DimValue,Data{iview}.DimValue(DimIndices))
     429%                 MergeData.Txt='ERROR: attempt at merging structured fields with different sizes';
     430%                 return
     431%             end
     432            for ivar=VarIndex
     433                VarName=MergeData.ListVarName{ivar};
     434                if isfield(MergeData,'VarAttribute')
     435                    if length(MergeData.VarAttribute)>=ivar && isfield(MergeData.VarAttribute{ivar},'Role') && isequal(MergeData.VarAttribute{ivar}.Role,'errorflag')
     436                        testFF=1;
     437                    end
     438                end
     439                eval(['MergeData.' VarName '=MergeData.' VarName '+ Data{iview}.' VarName ';'])
     440            end
     441        end
     442        if testFF
     443            nbaver=nbview-MergeData.FF;
     444            indgood=find(nbaver>0);
     445            for ivar=VarIndex
     446                VarName=MergeData.ListVarName{ivar};
     447                eval(['MergeData.' VarName '(indgood)=double(MergeData.' VarName '(indgood))./nbaver(indgood);'])
     448            end
     449        else
     450            for ivar=VarIndex
     451                VarName=MergeData.ListVarName{ivar};
     452                eval(['MergeData.' VarName '=double(MergeData.' VarName ')./nbview;'])
     453            end   
     454        end
     455    end
     456end
     457   
  • trunk/src/series/sub_background.m

    r54 r89  
    6565FileType=[];%default
    6666MovieObject=[];
     67FileExt=Series.FileExt;
     68
    6769if isequal(lower(FileExt),'.avi')
    6870    hhh=which('mmreader');
     
    7880   form=imformats(FileExt(2:end));
    7981   if ~isempty(form)% if the extension corresponds to an image format recognized by Matlab
    80        if isequal(NomType,'*');
     82       if isequal(Series.NomType,'*');
    8183           FileType='multimage';
    8284       else
     
    237239        ifile=indselect(ifield);
    238240        filename=name_generator(filebase,num_i1(ifile),num_j1(ifile),Series.FileExt,Series.NomType);
    239         Aread=read_image(filename,FileType,num_i1(ifile),movieobject);
     241        Aread=read_image(filename,FileType,num_i1(ifile),MovieObject);
    240242        Ak(:,:,ifield)=Aread;           
    241243    end
     
    272274                    ifile=indselect(ifield+step*floor(nbaver/2)+iburst-1);
    273275                    filename=name_generator(filebase,num_i1(ifile),num_j1(ifile),Series.FileExt,Series.NomType);
    274                     Aread=read_image(filename,FileType,num_i1(ifile),movieobject);
     276                    Aread=read_image(filename,FileType,num_i1(ifile),MovieObject);
    275277                    Ak(:,:,nbaver_ima-step+iburst)=Aread;
    276278                end
     
    316318%------------------------------------------------------------------------
    317319%--read images and convert them to the uint16 format used for PIV
    318 function A=read_image(filename,type_ima,num,movieobject)
     320function A=read_image(filename,type_ima,num,MovieObject)
    319321%------------------------------------------------------------------------
    320322%num is the view number needed for an avi movie
    321323switch type_ima
    322324    case 'movie'
    323         A=read(movieobject,num);
     325        A=read(MovieObject,num);
    324326    case 'avi'
    325327        mov=aviread(filename,num);
  • trunk/src/stra2num.m

    r19 r89  
    1212
    1313function numres=stra2num(str)
    14 numres=[]; %default
     14numres=NaN; %default
    1515if double(str) >= 48 & double(str) <= 57 % = test for number strings
    16     numres=str2num(str);
     16    numres=str2double(str);
    1717elseif double(str) >= 65 & double(str) <= 90 % test on ascii code for capital letters
    1818    numres=double(str)-64; %change capital letters to corresponding number in the alphabet
  • trunk/src/sub_field.m

    r86 r89  
    202202                V_1 =interp2(X_1,Y_1,V_1,x,y');
    203203           end
    204            val(['SubData.' UName '=Field.' UName '-U_1;'])
    205            val(['SubData.' VName '=Field.' VName '-V_1;'])
     204           eval(['SubData.' UName '=Field.' UName '-U_1;'])
     205           eval(['SubData.' VName '=Field.' VName '-V_1;'])
    206206       else
    207207           AName=Field.ListVarName{ivar_C};
  • trunk/src/uvmat.m

    r88 r89  
    165165% Object{iobj}.plotaxes and nbobj representation graphs  Object{iobj}.plothandles(:) (where nbobj is the
    166166% nbre of current objects opened in uvmat. Note that Object{iobj}.plothandles(iobj)=[] : an object is not represented in its own projection field;
    167 %-------------------------------------------------------------------
    168 %-------------------------------------------------------------------
     167
     168%------------------------------------------------------------------------
     169%------------------------------------------------------------------------
    169170%  I - MAIN FUNCTION UVMAT (DO NOT MODIFY)
    170 %-------------------------------------------------------------------
    171 %-------------------------------------------------------------------
     171%------------------------------------------------------------------------
     172%------------------------------------------------------------------------
    172173function varargout = uvmat(varargin)
    173174
     
    191192% End initialization code - DO NOT EDIT
    192193
    193 %-------------------------------------------------------------------
     194%------------------------------------------------------------------------
    194195% --- Executes just before uvmat is made visible.
    195196function uvmat_OpeningFcn(hObject, eventdata, handles, input )
    196 %-------------------------------------------------------------------
     197%------------------------------------------------------------------------
    197198global nb_builtin
    198199
     
    221222set(hObject,'DeleteFcn',{@closefcn})%
    222223
    223 %TRANSFORM menu: loads the information stored in prefdir to initiate the browser and the list of functions
     224%refresh projection plane
     225UvData.Object{1}.Style='plane';%main plotting plane
     226UvData.Object{1}.ProjMode='projection';%main plotting plane
     227if ~isfield(UvData.Object{1},'plotaxes')
     228    UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis
     229    set(handles.list_object_1,'Value',1);
     230    set(handles.list_object_1,'String',{'1-PLANE'});
     231end
     232
     233%TRANSFORM menu: builtin fcts
    224234menu_str={'';'phys';'px';'phys_polar'};
    225235nb_builtin=numel(menu_str); %number of functions
     
    238248end
    239249rmpath(fullfile(path_uvmat,'transform_field'))
    240 
    241 %refresh projection plane
    242 UvData.Object{1}.Style='plane';%main plotting plane
    243 UvData.Object{1}.ProjMode='projection';%main plotting plane
    244 if ~isfield(UvData.Object{1},'plotaxes')
    245     UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis
    246     set(handles.list_object_1,'Value',1);
    247     set(handles.list_object_1,'String',{'1-PLANE'});
    248 end
    249250
    250251%load the list of previously browsed files in menus Open and Open_1
     
    279280             if exist(file,'file')
    280281                h_func=str2func(file);
    281                 testexist=[testexist 1]; %#ok<AGROW>
     282                testexist=[testexist 1];
    282283             else
    283284                h_func=[];
    284                 testexist=[testexist 0];  %#ok<AGROW>
     285                testexist=[testexist 0];
    285286             end
    286              fct_handle=[fct_handle; {h_func}];%#ok<AGROW> %concatene the list of paths
     287             fct_handle=[fct_handle; {h_func}]; %concatene the list of paths
    287288             rmpath(path)
    288              menu_str=[menu_str; {file}]; %#ok<AGROW>
     289             menu_str=[menu_str; {file}];
    289290         end
    290291      end
     
    344345        set(handles.Fields,'Value',1)
    345346        set(handles.Fields,'String',{'get_field...'})   
    346        % set(handles.Fields,'UserData',Field)
    347347        testinputfield=1;
    348348       
     
    577577            [ff,rr,FileBase_1,ii,FileExt_1,SubDir_1]=read_file_boxes_1(handles);
    578578            NomType_1=get(handles.FileIndex_1,'UserData');     
    579             FileName_1=name_generator(FileBase_1,stra2num(i1),stra2num(i2),FileExt_1,NomType_1,1,stra2num(str_a),stra2num(str_b),SubDir_1);
     579            FileName_1=name_generator(FileBase_1,str2double(i1),str2double(i2),FileExt_1,NomType_1,1,stra2num(str_a),stra2num(str_b),SubDir_1);
    580580            if exist(FileName_1,'file')
    581                 FileIndex_1=name_generator('',stra2num(i1),stra2num(i2),'',NomType_1,1,stra2num(str_a),stra2num(str_b),'');
     581                FileIndex_1=name_generator('',str2double(i1),str2double(i2),'',NomType_1,1,stra2num(str_a),stra2num(str_b),'');
    582582                set(handles.FileIndex_1,'String',FileIndex_1)
    583583            else
     
    608608end
    609609
    610 %-------------------------------------------------------------------
     610%------------------------------------------------------------------------
    611611function RootPath_Callback(hObject,eventdata,handles)
     612%------------------------------------------------------------------------
    612613update_rootinfo(hObject,eventdata,handles);
    613614
    614 %-------------------------------------------------------------------
     615%------------------------------------------------------------------------
    615616%-- called by action in RootFile edit box
    616 %-------------------------------------------------------------------
    617617function SubDir_Callback(hObject, eventdata, handles)
     618%------------------------------------------------------------------------
    618619%refresh the menu of input fields
    619620Fields_Callback(hObject, eventdata, handles);
     
    621622run0_Callback(hObject, eventdata, handles);
    622623
    623 
    624 %-------------------------------------------------------------------
    625 %-- called by action in RootFile edit box
    626 %-------------------------------------------------------------------
     624%------------------------------------------------------------------------
     625% --- called by action in RootFile edit box
    627626function RootFile_Callback(hObject, eventdata, handles)
     627%------------------------------------------------------------------------
    628628update_rootinfo(hObject,eventdata,handles)
    629629
    630 %-------------------------------------------------------------------
    631 %-- called by action in FileIndex edit box
    632 %-------------------------------------------------------------------
     630%------------------------------------------------------------------------
     631% --- called by action in FileIndex edit box
    633632function FileIndex_Callback(hObject, eventdata, handles)
     633%------------------------------------------------------------------------
    634634FileIndices=get(handles.FileIndex,'String');
    635635if isempty(str2num(FileIndices))
     
    647647run0_Callback(hObject, eventdata, handles)
    648648
    649 %-------------------------------------------------------------------
    650 %-- called by action in FileIndex_1 edit box
    651 %-------------------------------------------------------------------
     649%------------------------------------------------------------------------
     650% --- called by action in FileIndex_1 edit box
    652651function FileIndex_1_Callback(hObject, eventdata, handles)
    653 % FileIndices=get(handles.FileIndex_1,'String');
    654 % if isempty(str2num(FileIndices))
    655 %     [pp,ff,str1,str2,str_a,str_b]=name2display(FileIndices)
    656 % else
    657 %     str1=FileIndices;
    658 %     str2='';
    659 %     str_a='';
    660 %     str_b='';
    661 % end
    662 % set(handles.i1,'String',str1);
    663 % set(handles.i2,'String',str2);
    664 % set(handles.j1,'String',str_a);
    665 % set(handles.j2,'String',str_b);
     652%------------------------------------------------------------------------
    666653run0_Callback(hObject, eventdata, handles)
    667654
    668 %-------------------------------------------------------------------
    669 % -- update information about a new field series (indices to scan, timing, calibration from an xml file, then refresh current plots
    670 %-------------------------------------------------------------------
     655%------------------------------------------------------------------------
     656% --- update information about a new field series (indices to scan, timing, calibration from an xml file, then refresh current plots
    671657function update_rootinfo(hObject,eventdata,handles)
    672 
     658%------------------------------------------------------------------------
    673659set(handles.RootPath,'BackgroundColor',[1 1 0])
    674660drawnow
     
    678664UvData.TestInputFile=1;
    679665set(handles.fix_pair,'Value',1) % activate by default the comp_input '-'input window
    680 %FileIndex_Callback(hObject, eventdata, handles)% update field counters
    681666
    682667[FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles);
     
    693678TimeUnit=[];%default
    694679testima=0; %test for image input
     680imainfo=[];
     681ColorType='falsecolor'; %default
     682hhh='';
    695683if isequal(lower(FileExt),'.avi') %.avi file
    696684    testima=1;
    697     info=aviinfo([FileBase FileIndices FileExt]);
    698     nbfield=info.NumFrames;
     685    imainfo=aviinfo([FileBase FileIndices FileExt]);
     686    nbfield=imainfo.NumFrames;
    699687    nburst=1;
    700     set(handles.Dt_txt,'String',['Dt=' num2str(1000/info.FramesPerSecond) 'ms']);%display the elementary time interval in millisec
    701     XmlData.Time=(0:1/info.FramesPerSecond:(info.NumFrames-1)/info.FramesPerSecond)';
     688    set(handles.Dt_txt,'String',['Dt=' num2str(1000/imainfo.FramesPerSecond) 'ms']);%display the elementary time interval in millisec
     689    XmlData.Time=(0:1/imainfo.FramesPerSecond:(imainfo.NumFrames-1)/imainfo.FramesPerSecond)';
    702690    TimeUnit='s';
    703     set(handles.npx,'String',num2str(info.Width));%fills nbre of pixels x box
    704     set(handles.npy,'String',num2str(info.Height));%fills nbre of pixels y box
    705691    hhh=which('mmreader');
    706     if ~isequal(hhh,'')&& mmreader.isPlatformSupported()% if the function is found (recent version of matlab)
    707         UvData.MovieObject=mmreader([FileBase FileIndices FileExt]);
    708     end
     692    ColorType=imainfo.ImageType;%='truecolor' for color images
    709693elseif ~isempty(imformats(FileExt(2:end))) || isequal(FileExt,'.vol')%&& isequal(NomType,'*')% multi-frame image
    710694    testima=1;
     
    715699        imainfo=imfinfo([FileBase FileIndices FileExt]);
    716700    end
     701    ColorType=imainfo.ColorType;%='truecolor' for color images
    717702    if length(imainfo) >1 %case of image with multiple frames
    718703        nbfield=length(imainfo);
    719704        nburst=1;
    720705    end
    721     if isfield(UvData,'MovieObject')
    722         UvData=rmfield(UvData,'MovieObject');
    723     end
    724 else
    725     %set(handles.last_i,'String','');%fills last_field box
     706end
     707if ~strcmp(hhh,'')&& mmreader.isPlatformSupported()% if the function is found (recent version of matlab)
     708    UvData.MovieObject=mmreader([FileBase FileIndices FileExt]);
     709elseif isfield(UvData,'MovieObject')
     710    UvData=rmfield(UvData,'MovieObject');
     711end
     712if isfield(imainfo,'Width') && isfield(imainfo,'Height')
     713    set(handles.npx,'String',num2str(imainfo.Width));%fills nbre of pixels x box
     714    set(handles.npy,'String',num2str(imainfo.Height));%fills nbre of pixels x box
     715else
    726716    set(handles.npx,'String','');%fills nbre of pixels x box
    727     set(handles.npy,'String','');%fills nbre of pixels y box
    728     if isfield(UvData,'MovieObject')
    729         UvData=rmfield(UvData,'MovieObject');
    730     end
    731 end
     717    set(handles.npy,'String','');%fills nbre of pixels x box
     718end
     719set(handles.BW,'Value',strcmp(ColorType,'grayscale'))% select handles.BW if grayscale image
    732720
    733721% read parameters (time, geometric calibration..) from a documentation file (.xml advised)
     
    821809        set(handles.transform_fct,'Value',1); %  no transform by default
    822810    else
    823         if (isfield(GeometryCalib,'R')& ~isequal(GeometryCalib.R(2,1),0) & ~isequal(GeometryCalib.R(1,2),0)) |...
    824             (isfield(GeometryCalib,'kappa1')& ~isequal(GeometryCalib.kappa1,0))
     811        if (isfield(GeometryCalib,'R')&& ~isequal(GeometryCalib.R(2,1),0) && ~isequal(GeometryCalib.R(1,2),0)) |...
     812            (isfield(GeometryCalib,'kappa1')&& ~isequal(GeometryCalib.kappa1,0))
    825813            set(handles.pxcm,'String','var')
    826814            set(handles.pycm,'String','var')
     
    835823        end
    836824        if isfield(GeometryCalib,'SliceCoord')
     825           
    837826           siz=size(GeometryCalib.SliceCoord);
    838827           if siz(1)>1
     
    847836           end
    848837           slices_Callback(hObject, eventdata, handles)
    849     %        Coord=UvData.XmlData.GeometryCalib.SliceCoord;
    850     %        ZIndex=num_i1-NbSlice*(floor((num_i1-1)/NbSlice));
    851         end
    852 
    853            
     838        end           
    854839    end
    855840end
    856841
    857842%update the data attached to the uvmat interface
    858 % set(handles.nb_slice,'String',num2str(NbSlice))
    859843if ~isempty(TimeUnit)
    860844    set(handles.time_txt,'String',['time (' TimeUnit ')'])
    861845end
    862 %set(handles.DtUnit,'String',['10^(-3)' TimeUnit])
    863846UvData.TimeUnit=TimeUnit;
    864847UvData.XmlData=XmlData;
     
    986969end
    987970sizf=size(fileinput_1);
    988 if (~ischar(fileinput_1)|~isequal(sizf(1),1)),return;end
     971if (~ischar(fileinput_1)||~isequal(sizf(1),1)),return;end
    989972
    990973% refresh the current displayed field
     
    11971180end
    11981181TimeUnit_1=[];
    1199 % testima=0; %test for image input
     1182hhh='';%default, test for  movie reading with mmreader
     1183imainfo=[];
    12001184if isequal(lower(FileExt),'.avi') %.avi file
    1201 %     testima=1;
    1202     info=aviinfo([FileBase FileIndices FileExt]);
    1203     nbfield_1=info.NumFrames;
     1185    imainfo=aviinfo([FileBase FileIndices FileExt]);
     1186    nbfield_1=imainfo.NumFrames;
    12041187    nburst_1=1;
    1205     %set(handles.last_i,'String',num2str(info.NumFrames));%fills last_field box
    12061188    set(handles.Dt_txt,'String',['Dt=' num2str(1000/info.FramesPerSecond) 'ms']);%display the elementary time interval in millisec
    1207 %     set(handles.dt,'UserData',info.FramesPerSecond);
    1208     time=[0:1/info.FramesPerSecond:(info.NumFrames-1)/info.FramesPerSecond]';
    1209     npx=get(handles.npx,'String');
    1210     npy=get(handles.npy,'String');
    1211     if isequal(npx,'') || isequal(npy,'')
    1212         set(handles.npx,'String',num2str(info.Width));%fills nbre of pixels x box
    1213         set(handles.npy,'String',num2str(info.Height));%fills nbre of pixels y box
    1214     end
    1215 elseif ~isempty(imformats(FileExt(2:end))) %&& isequal(NomType,'*')% multi-frame image
     1189    time=[0:1/imainfo.FramesPerSecond:(imainfo.NumFrames-1)/imainfo.FramesPerSecond]';
     1190    ColorType=imainfo.ImageType;%='truecolor' for color images
     1191    hhh=which('mmreader');
     1192elseif ~isempty(imformats(FileExt(2:end)))|| isequal(FileExt,'.vol')
    12161193    testima=1;
    1217     imainfo=imfinfo([FileBase FileIndices FileExt]); 
     1194    if ~isequal(SubDir,'')
     1195        RootFile=get(handles.RootFile,'String');
     1196        imainfo=imfinfo([fullfile(RootPath,SubDir,RootFile) FileIndices FileExt]);
     1197    else
     1198        imainfo=imfinfo([FileBase FileIndices FileExt]);
     1199    end
     1200    ColorType=imainfo.ColorType;%='truecolor' for color images
    12181201    if length(imainfo) >1 %case of image with multiple frames
    12191202        nbfield_1=length(imainfo);
    12201203        nburst_1=1;
    1221         %set(handles.last_i,'String',num2str(length(imainfo)));%fills last_field box
    1222     end       
    1223 else
    1224     %set(handles.last_i,'String','');%fills last_field box
    1225     set(handles.npx,'String','');%fills nbre of pixels x box
    1226     set(handles.npy,'String','');%fills nbre of pixels y box
     1204    end
     1205end
     1206if ~strcmp(hhh,'')&& mmreader.isPlatformSupported()% if the function is found (recent version of matlab)
     1207    UvData.MovieObject_1=mmreader([FileBase FileIndices FileExt]);
     1208elseif isfield(UvData,'MovieObject_1')
     1209    UvData=rmfield(UvData,'MovieObject_1');
     1210end
     1211if strcmp(get(handles.npx,'String'),'') || strcmp(get(handles.npy,'String'),'')%update npx and npy if it is not already filled by the first input field
     1212    if  isfield(imainfo,'Width') && isfield(imainfo,'Height')
     1213        set(handles.npx,'String',num2str(imainfo.Width));%fills nbre of pixels x box
     1214        set(handles.npy,'String',num2str(imainfo.Height));%fills nbre of pixels x box
     1215    else
     1216        set(handles.npx,'String','');%fills nbre of pixels x box
     1217        set(handles.npy,'String','');%fills nbre of pixels x box
     1218    end
     1219    set(handles.BW,'Value',strcmp(ColorType,'grayscale'))% select handles.BW if grayscale image
    12271220end
    12281221
     
    18491842end
    18501843
    1851 num_i1=stra2num(get(handles.i1,'String'));
     1844num_i1=str2double(get(handles.i1,'String'));
    18521845num_j1=stra2num(get(handles.j1,'String'));
    1853 num_i2=stra2num(get(handles.i2,'String'));
     1846num_i2=str2double(get(handles.i2,'String'));
    18541847num_j2=stra2num(get(handles.j2,'String'));
    1855 if isempty(num_j2)
     1848if isnan(num_j2)
    18561849    if isempty(num_i2)   
    18571850        msgbox_uvmat('ERROR', 'a second image index i2 or j2 is needed to show the pair as a movie')
     
    18621855    end
    18631856end
    1864 if isempty(num_i2)
     1857if isnan(num_i2)
    18651858    num_i2=num_i1;%repeat the index i1 by default
    18661859end
     
    22382231    if isequal(FileType,'netcdf')  %read the first nc field
    22392232        if isequal(FieldName,'get_field...')% read the field names on the interface get_field.
    2240             %VelType=get(handles.Fields,'UserData');
    2241             hget_field=findobj(allchild(0),'Name','get_field')%find the get_field... GUI
     2233            hget_field=findobj(allchild(0),'Name','uvmat_field');%find the get_field... GUI
    22422234            if isempty(hget_field)
    2243                 hget_field= get_field(filename);%open the get_field GUI   
    2244             end
    2245             if numel(hget_field)>1%case of several get_field GUI
    2246                 hget_field=hget_field(1);
     2235                hget_field= get_field(filename);%open the get_field GUI   
     2236                set(hget_field,'name','uvmat_field')
     2237            elseif UvData.NewSeries
     2238                delete(hget_field)
     2239                hget_field= get_field(filename);%open the get_field GUI
     2240                set(hget_field,'name','uvmat_field')
    22472241            end
    22482242            hhget_field=guidata(hget_field);
    2249             set(hhget_field.inputfile,'String',filename)% update the list of input fields in get_field
    2250             set(hhget_field.ACTION,'Value',1)% PLOT option selected
    2251             set(hhget_field.list_fig,'Value',2)% plotting axes =uvmat selected
    2252             [Field{1},errormsg]=read_get_field(hget_field); %read the names of the variables to plot in the get_field GUI
    2253             if ~isempty(errormsg)
    2254                 errormsg=['error in uvmat/run0_Callback/read_get_field: ' errormsg];
    2255                 return
    2256             end
     2243            funct_list=get(hhget_field.ACTION,'UserData');
     2244            funct_index=get(hhget_field.ACTION,'Value');
     2245            funct=funct_list{funct_index};
     2246            Field{1}=funct(hget_field); %read the names of the variables to plot in the get_field GUI
    22572247            CivStage=0;
    2258             VelType_out=[];         
     2248            VelType_out=[];   
    22592249        else
    22602250            [Field{1},VelType_out]=read_civxdata(filename,InputField,VelType);
     
    22692259    if ~isempty(filename_1) && ~test_keepdata_1 && isequal(FileType_1,'netcdf') %read the second file
    22702260        if isequal(FieldName_1,'get_field...')% read the field names on the interface get_field.
    2271             hget_field=findobj(allchild(0),'Name','get_field_1');%find the get_field... GUI
    2272              if isempty(hget_field)
    2273                  hget_field= get_field(filename_1);%open the get_field GUI
    2274                  set(hget_field,'name','get_field_1')
    2275 %                 enable_transform(handles,'off')% no field transform (possible transform in the GUI get_field)
    2276              end
    2277             hhget_field=guidata(hget_field);%handles of GUI elements in get_field
    2278             SubField=get_field('read_var_names',hObject,eventdata,hhget_field); %read the names of the variables to plot in the get_field GUI
    2279             [Field{2},var_detect]=nc2struct(filename_1,SubField.ListVarName); %read the corresponding input data               
    2280             Field{2}.VarAttribute=SubField.VarAttribute;
    2281             %update the display on get_field
    2282             set(hhget_field.inputfile,'String',filename_1)
    2283             set(hhget_field.variables,'Value',1)
    2284             Tabchar={''};%default
    2285             Tabcell=[];
    2286             if isfield(Field{2},'ListGlobalAttribute')& ~isempty(Field{2}.ListGlobalAttribute)
    2287                 for iline=1:length(Field{2}.ListGlobalAttribute)
    2288                     Tabcell{iline,1}=Field{2}.ListGlobalAttribute{iline};
    2289                     if isfield(Field{2}, Field{2}.ListGlobalAttribute{iline})
    2290                         eval(['val=Field{2}.' Field{2}.ListGlobalAttribute{iline} ';'])
    2291                         if ischar(val);
    2292                             Tabcell{iline,2}=val;
    2293                         else
    2294                             Tabcell{iline,2}=num2str(val);
    2295                         end
    2296                     end
    2297                 end
    2298                 if ~isempty(Tabcell)
    2299                     Tabchar=cell2tab(Tabcell,'=');
    2300                     Tabchar=[{''};Tabchar];
    2301                 end
     2261            hget_field_1=findobj(allchild(0),'Name','uvmat_field_1');%find the get_field... GUI
     2262            if isempty(hget_field_1)
     2263                 hget_field_1= get_field(filename_1);%open the get_field GUI
     2264                 set(hget_field_1,'name','uvmat_field_1')
    23022265            end
    2303             set(hhget_field.attributes,'String',Tabchar);%update list of global attributes in get_field
     2266            hhget_field_1=guidata(hget_field_1);%handles of GUI elements in get_field
     2267            funct_list=get(hhget_field_1.ACTION,'UserData');
     2268            funct_index=get(hhget_field_1.ACTION,'Value');
     2269            funct=funct_list{funct_index};
     2270            Field{2}=funct(hget_field_1); %read the names of the variables to plot in the get_field GUI
    23042271        else
    23052272            [Field{2},VelType_out_1]=read_civxdata(filename_1,InputField_1,VelType_1);
     
    23792346       if siz(1)>1
    23802347           NbSlice=siz(1);
    2381 %            set(handles.slices,'Visible','on')
    2382 %            set(handles.slices,'Value',1)
    23832348       else
    23842349           NbSlice=1;
    23852350       end
    2386        %set(handles.nb_slice,'String',num2str(NbSlice))
    2387 %        slices_Callback(handles.uvmat, [], handles)
    23882351end
    23892352
     
    25102473end
    25112474%case of structured coordinates
    2512 if isfield(UvData.Field,'AX') & isfield(UvData.Field,'AY')& isfield(UvData.Field,'A')
     2475if isfield(UvData.Field,'AX') && isfield(UvData.Field,'AY')&& isfield(UvData.Field,'A')
    25132476    UvData.XMax=max(UvData.Field.AX);
    25142477    UvData.XMin=min(UvData.Field.AX);
     
    25182481    UvData.Mesh=sqrt((UvData.XMax-UvData.XMin)*(UvData.YMax-UvData.YMin)/((np_A(1)-1) * (np_A(2)-1))) ;
    25192482end
    2520 if  isempty(coord_x)&~isempty(CellVarIndex)
     2483if  isempty(coord_x) && ~isempty(CellVarIndex)
    25212484    VarIndex=CellVarIndex{imax}; % list of variable indices
    25222485    DimIndex=UvData.Field.VarDimIndex{VarIndex(1)}; %list of dim indices for the variable
     
    26402603        %Projeter les champs sur l'objet:*
    26412604        ObjectData=proj_field(UvData.Field,UvData.Object{iobj},iobj);
    2642 %         if imap==2
    2643 %             UvData.ProjField_2=ObjectData;%store the projection field on uvmat: ***** WILL REPLACE THE FIELD SORED ON THE AXES: AxeData *****
    2644 %         else
    2645 %             UvData.ProjField_1=ObjectData;%store the projection field on view_field
    2646 %         end
    26472605        %use of mask
    26482606        if isfield(ObjectData,'NbDim')&isequal(ObjectData.NbDim,2)
     
    27782736testimedoc=0;
    27792737if isfield(UvData,'XmlData') && isfield(UvData.XmlData,'Time')
    2780     if isempty(num_i2)
     2738    if isempty(num_i2)||isnan(num_i2)
    27812739        num_i2=num_i1;
    27822740    end
    2783     if isempty(num_j1)
     2741    if isempty(num_j1)||isnan(num_j1)
    27842742        num_j1=1;
    27852743    end
    2786     if isempty(num_j2)
     2744    if isempty(num_j2)||isnan(num_j2)
    27872745        num_j2=num_j1;
    27882746    end
     
    28282786    end
    28292787end
    2830 
     2788%update the input file name in the get_field GUI
     2789if isequal(FieldName,'get_field...')
     2790    set(hhget_field.inputfile,'String',filename)
     2791    Tabchar={''};%default
     2792    Tabcell=[];
     2793    if isfield(Field{1},'ListGlobalAttribute')& ~isempty(Field{1}.ListGlobalAttribute)
     2794        for iline=1:length(Field{1}.ListGlobalAttribute)
     2795            Tabcell{iline,1}=Field{1}.ListGlobalAttribute{iline};
     2796            if isfield(Field{1}, Field{1}.ListGlobalAttribute{iline})
     2797                eval(['val=Field{1}.' Field{1}.ListGlobalAttribute{iline} ';'])
     2798                if ischar(val);
     2799                    Tabcell{iline,2}=val;
     2800                else
     2801                    Tabcell{iline,2}=num2str(val);
     2802                end
     2803            end
     2804        end
     2805        if ~isempty(Tabcell)
     2806            Tabchar=cell2tab(Tabcell,'=');
     2807            Tabchar=[{''};Tabchar];
     2808        end
     2809    end
     2810    set(hhget_field.attributes,'String',Tabchar);%update list of global attributes in get_field
     2811end
     2812if isequal(FieldName_1,'get_field...')
     2813    set(hhget_field_1.inputfile,'String',filename_1)
     2814    Tabchar={''};%default
     2815    Tabcell=[];
     2816    if isfield(Field{2},'ListGlobalAttribute')& ~isempty(Field{2}.ListGlobalAttribute)
     2817        for iline=1:length(Field{2}.ListGlobalAttribute)
     2818            Tabcell{iline,1}=Field{2}.ListGlobalAttribute{iline};
     2819            if isfield(Field{2}, Field{2}.ListGlobalAttribute{iline})
     2820                eval(['val=Field{2}.' Field{2}.ListGlobalAttribute{iline} ';'])
     2821                if ischar(val);
     2822                    Tabcell{iline,2}=val;
     2823                else
     2824                    Tabcell{iline,2}=num2str(val);
     2825                end
     2826            end
     2827        end
     2828        if ~isempty(Tabcell)
     2829            Tabchar=cell2tab(Tabcell,'=');
     2830            Tabchar=[{''};Tabchar];
     2831        end
     2832    end
     2833    set(hhget_field_1.attributes,'String',Tabchar);%update list of global attributes in get_field
     2834end
    28312835
    28322836
     
    28582862    set(handles.auto_xy,'BackgroundColor',[1 1 0])
    28592863    cla(handles.axes3)
    2860     update_plot(handles)
     2864    update_plot(handles);
    28612865else
    28622866    set(handles.auto_xy,'BackgroundColor',[0.7 0.7 0.7])
    2863     update_plot(handles)
     2867    update_plot(handles);
    28642868%     axis(handles.axes3,'image')
    28652869end
     
    30393043end
    30403044
    3041 % %----------------------------------------------
    3042 % %read the data displayed for the input rootfile windows (new)
    3043 % %-------------------------------------------------
     3045%------------------------------------------------------------------------
     3046% --- read the data displayed for the input rootfile windows (new)
    30443047function [FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles)
     3048%------------------------------------------------------------------------
    30453049RootPath=get(handles.RootPath,'String');
    30463050FileName=RootPath; %default
     
    31143118     set_veltype_display(veltype_handles,0) % unvisible civ buttons
    31153119     filename=read_file_boxes(handles);
    3116      hget_field=findobj(allchild(0),'name','get_field');
    3117      if ~isempty(hget_field)
    3118          delete(hget_field)
     3120     hget_field=findobj(allchild(0),'name','uvmat_field');
     3121     if isempty(hget_field)
     3122         hget_field=get_field(filename);
     3123         set(hget_field,'Name','uvmat_field')       
    31193124     end
    3120      get_field(filename)
    31213125    return %no action
    31223126end
     
    38493853% set(handles.slider1,'Value',col)
    38503854set_vec_col_bar(handles)
    3851 update_plot(handles)
     3855update_plot(handles);
    38523856
    38533857%----------------------------------------------------------------
     
    38593863% slider2_Callback(hObject, eventdata, handles)
    38603864set_vec_col_bar(handles)
    3861 update_plot(handles)
     3865update_plot(handles);
    38623866%------------------------------------------------------------
    38633867%update the slider values after displaying vectors
     
    38853889set_vec_col_bar(handles)
    38863890
    3887 % %--------------------------------------------
    3888 % %update the display of color code for vectors
    3889 % %--------------------------------------------
    3890 % function set_vec_col_bar(handles)
    3891 % %get the image of the color display button 'vec_col_bar' in pixels
    3892 % uni=get(handles.vec_col_bar,'Unit');
    3893 % set(handles.vec_col_bar,'Unit','pixel')
    3894 % pos_vert=get(handles.vec_col_bar,'Position');
    3895 % set(handles.vec_col_bar,'Unit','Normalized')
    3896 % width=ceil(pos_vert(3));
    3897 % height=ceil(pos_vert(4));
    3898 % %get slider indications
    3899 % colcode.min=get(handles.slider1,'Min');
    3900 % colcode.max=get(handles.slider1,'Max');
    3901 % colcode.colcode1=get(handles.slider1,'Value');
    3902 % colcode.colcode2=get(handles.slider2,'Value');
    3903 % colcode.option=get(handles.vec_col_bar,'Value');
    3904 % colcode.auto=1;
    3905 % list_code=get(handles.col_vec,'String');% list menu fields
    3906 % index_code=get(handles.col_vec,'Value');% selected string index
    3907 % colcode.CName= list_code{index_code(1)}; % selected field used for vector color
    3908 % vec_C=colcode.min+(colcode.max-colcode.min)*[0.5:width-0.5]/width;%sample of vec_C values from min to max
    3909 % [colorlist,col_vec]=set_col_vec(colcode,vec_C);
    3910 % oneheight=ones(1,height);
    3911 % A1=colorlist(col_vec,1)*oneheight;
    3912 % A2=colorlist(col_vec,2)*oneheight;
    3913 % A3=colorlist(col_vec,3)*oneheight;
    3914 % A(:,:,1)=A1';
    3915 % A(:,:,2)=A2';
    3916 % A(:,:,3)=A3';
    3917 % set(handles.vec_col_bar,'Cdata',A)
    3918 
    3919 %--------------------------------------------------------
    3920 % --- Executes on button press in cal.
    3921 function cal_Callback(hObject, eventdata, handles)
    3922 
    3923 
    3924 
    39253891%-------------------------------------------------------------
    39263892% --- Executes on selection change in transform_fct.
     
    39403906    dlg_title = 'user defined transform';
    39413907    num_lines= 1;
    3942     [FileName, PathName, filterindex] = uigetfile( ...
     3908    [FileName, PathName] = uigetfile( ...
    39433909       {'*.m', ' (*.m)';
    39443910        '*.m',  '.m files '; ...
     
    40153981list_object_2_Callback(hObject, eventdata, handles)
    40163982
    4017 
    4018 
    40193983%delete mask if it is displayed
    40203984if isequal(get(handles.mask_test,'Value'),1)%if the mask option is on
     
    41154079set(handles.AutoScal,'Value',1) %suppress auto mode
    41164080set(handles.AutoScal,'BackgroundColor',[1 1 0])
    4117 update_plot(handles)
     4081update_plot(handles);
    41184082
    41194083%-----------------------------------------------------------------
     
    41224086set(handles.AutoScal,'Value',1) %suppress auto mode
    41234087set(handles.AutoScal,'BackgroundColor',[1 1 0])
    4124 update_plot(handles)
     4088update_plot(handles);
    41254089
    41264090%-----------------------------------------------
     
    41334097    set(handles.AutoScal,'BackgroundColor',[0.7 0.7 0.7])
    41344098    update_plot(handles);
    4135 %     set(handles.MinA,'String',num2str(ScalOut.MinA,3))
    4136 %     set(handles.MaxA,'String',num2str(ScalOut.MaxA,3))
    41374099end
    41384100
     
    41404102function BW_Callback(hObject, eventdata, handles)
    41414103%-------------------------------------------------------------------
    4142 update_plot(handles)
     4104update_plot(handles);
    41434105
    41444106%-------------------------------------------------------------------
     
    41534115    set(handles.IncrA,'Visible','off')
    41544116end
    4155 update_plot(handles)
     4117update_plot(handles);
    41564118
    41574119%-------------------------------------------------------------------
    41584120function IncrA_Callback(hObject, eventdata, handles)
    41594121%-------------------------------------------------------------------
    4160 update_plot(handles)
     4122update_plot(handles);
    41614123
    41624124%-------------------------------------------------------------------
    41634125function HideWarning_Callback(hObject, eventdata, handles)
    41644126%-------------------------------------------------------------------
    4165 update_plot(handles)
     4127update_plot(handles);
    41664128
    41674129%-------------------------------------------------------------------
    41684130function HideFalse_Callback(hObject, eventdata, handles)
    41694131%-------------------------------------------------------------------
    4170 update_plot(handles)
     4132update_plot(handles);
    41714133
    41724134%-------------------------------------------------------------------
     
    41754137set(handles.AutoVec,'Value',1);
    41764138set(handles.AutoVec,'BackgroundColor',[1 1 0])
    4177 update_plot(handles)
     4139update_plot(handles);
    41784140
    41794141%-------------------------------------------------------------------
     
    41894151end
    41904152
    4191 %-------------------------------------------------------
     4153%------------------------------------------------------------------------
    41924154% --- Executes on selection change in decimate4 (nb_vec/4).
    4193 %-------------------------------------------------------
    41944155function decimate4_Callback(hObject, eventdata, handles)
    4195 update_plot(handles)
    4196 
    4197 
    4198 %-------------------------------------------------------
     4156%------------------------------------------------------------------------
     4157update_plot(handles);
     4158
     4159%------------------------------------------------------------------------
    41994160% --- Executes on selection change in color_code menu
    4200 %-------------------------------------------------------
    42014161function color_code_Callback(hObject, eventdata, handles)
     4162%------------------------------------------------------------------------
    42024163set_vec_col_bar(handles)
    42034164update_plot(handles);
    42044165
    4205 %-------------------------------------------------------
     4166%------------------------------------------------------------------------
    42064167% --- Executes on button press in AutoVecColor.
    4207 %-------------------------------------------------------
    42084168function AutoVecColor_Callback(hObject, eventdata, handles)
     4169%------------------------------------------------------------------------
    42094170test=get(handles.AutoVecColor,'Value');
    42104171if test
     
    42154176    set(handles.AutoVecColor,'BackgroundColor',[0.7 0.7 0.7])
    42164177end
    4217 %set_vec_col_bar(handles)
    4218 
    4219 %-------------------------------------------------------
     4178
     4179%------------------------------------------------------------------------
    42204180% --- Executes on selection change in max_vec.
    4221 %-------------------------------------------------------
    42224181function min_vec_Callback(hObject, eventdata, handles)
     4182%------------------------------------------------------------------------
    42234183max_vec_Callback(hObject, eventdata, handles)
    42244184
     4185%------------------------------------------------------------------------
    42254186% --- Executes on selection change in max_vec.
    42264187function max_vec_Callback(hObject, eventdata, handles)
     4188%------------------------------------------------------------------------
    42274189set(handles.AutoVecColor,'Value',1)
    42284190AutoVecColor_Callback(hObject, eventdata, handles)
     
    42374199update_plot(handles);
    42384200
    4239 %-------------------------------------------------------------------
    4240 %update the display of color code for vectors
     4201%------------------------------------------------------------------------
     4202% --- update the display of color code for vectors
    42414203function set_vec_col_bar(handles)
    4242 %-------------------------------------------------------------------
     4204%------------------------------------------------------------------------
    42434205%get the image of the color display button 'vec_col_bar' in pixels
    42444206set(handles.vec_col_bar,'Unit','pixel');
     
    42834245AxeData=get(haxes,'UserData');
    42844246PlotParam=read_plot_param(handles);
     4247PlotParam.Scalar
    42854248[PlotType,PlotParamOut]= plot_field(AxeData,haxes,PlotParam,1);
    42864249write_plot_param(handles,PlotParamOut); %update the auto plot parameters
     
    44464409%------------------------------------------------------
    44474410function MenuExportField_Callback(hObject, eventdata, handles)
    4448 global CurData
    4449 CurData=get(handles.uvmat,'UserData');
    4450 evalin('base','global CurData')%make CurData global in the workspace
     4411global Data_uvmat
     4412Data_uvmat=get(handles.uvmat,'UserData');
     4413evalin('base','global Data_uvmat')%make CurData global in the workspace
    44514414display(['current field :'])
    4452 evalin('base','CurData') %display CurData in the workspace
     4415evalin('base','Data_uvmat') %display CurData in the workspace
    44534416commandwindow; %brings the Matlab command window to the front
    44544417
     
    49764939       '*.xml',  '.xml files '; ...
    49774940        '*.mat',  '.mat matlab files '}, ...
    4978         'Pick a file',get(handles.RootPath,'String'));
     4941        'Pick an xml Object file',get(handles.RootPath,'String'));
    49794942fileinput=[PathName FileName];%complete file name
    49804943testblank=findstr(fileinput,' ');%look for blanks
Note: See TracChangeset for help on using the changeset viewer.