source: trunk/src/uvmat_doc/FUNCTIONS_DOC/get_field.html @ 37

Last change on this file since 37 was 37, checked in by sommeria, 14 years ago

create_grid.fig ,
uvmat_doc and all the included files added

File size: 142.4 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
2                "http://www.w3.org/TR/REC-html40/loose.dtd">
3<html>
4<head>
5  <title>Description of get_field</title>
6  <meta name="keywords" content="get_field">
7  <meta name="description" content="'get_field': display variables and attributes from a Netcdf file, and plot selected fields">
8  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
9  <meta name="generator" content="m2html &copy; 2003 Guillaume Flandin">
10  <meta name="robots" content="index, follow">
11  <link type="text/css" rel="stylesheet" href="../m2html.css">
12</head>
13<body>
14<a name="_top"></a>
15<div><a href="../index.html">Home</a> &gt;  <a href="index.html">.</a> &gt; get_field.m</div>
16
17<!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png">&nbsp;Master index</a></td>
18<td align="right"><a href="index.html">Index for .&nbsp;<img alt=">" border="0" src="../right.png"></a></td></tr></table>-->
19
20<h1>get_field
21</h1>
22
23<h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
24<div class="box"><strong>'get_field': display variables and attributes from a Netcdf file, and plot selected fields</strong></div>
25
26<h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
27<div class="box"><strong>function varargout = get_field(varargin) </strong></div>
28
29<h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
30<div class="fragment"><pre class="comment">'get_field': display variables and attributes from a Netcdf file, and plot selected fields
31------------------------------------------------------------------------
32function varargout = get_field(varargin)
33 associated with the GUI get_field.fig
34
35AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
36  Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org.
37AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
38     This file is part of the toolbox UVMAT.
39 
40     UVMAT is free software; you can redistribute it and/or modify
41     it under the terms of the GNU General Public License as published by
42     the Free Software Foundation; either version 2 of the License, or
43     (at your option) any later version.
44 
45     UVMAT is distributed in the hope that it will be useful,
46     but WITHOUT ANY WARRANTY; without even the implied warranty of
47     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
48     GNU General Public License (file UVMAT/COPYING.txt) for more details.
49AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</pre></div>
50
51<!-- crossreference -->
52<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
53This function calls:
54<ul style="list-style-image:url(../matlabicon.gif)">
55<li><a href="cell2tab.html" class="code" title="function Tabchar=cell2tab(Tabcell,separator)">cell2tab</a>      'cell2tab': transform a Matlab cell in a character array suitable for display in a table</li><li><a href="check_functions.html" class="code" title="function [errormsg,date_str]=check_functions">check_functions</a>   'check_functions': check the path and modification date for all the</li><li><a href="find_field_indices.html" class="code" title="function [CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(Data)">find_field_indices</a>       'find_file_indices': group the variables of a nc-formated Matlab structure into 'fields' with common dimensions</li><li><a href="msgbox_uvmat.html" class="code" title="function varargout = msgbox_uvmat(varargin)">msgbox_uvmat</a>   'msgbox_uvmat': associated with GUI msgbox_uvmat.fig to display message boxes, for error, warning or input calls</li><li><a href="nc2struct.html" class="code" title="function [Data,var_detect,ichoice]=nc2struct(nc,ListVarName)">nc2struct</a>       'nc2struct': transform a netcdf file in a corresponding matlab structure</li><li><a href="peaklock.html" class="code" title="function [histinter,x,error]=peaklock(nbb,minim,maxim,histu)">peaklock</a> 'peaklock': determines peacklocking errors from velocity histograms.</li><li><a href="plot_field.html" class="code" title="function [PlotType,PlotParamOut,haxes]= plot_field(Data,haxes,PlotParam,KeepLim,PosColorbar)">plot_field</a> 'plot_field': plot any field with the structure defined in the uvmat package</li><li><a href="read_get_field.html" class="code" title="function [SubField,errormsg]=read_get_field(hget_field)">read_get_field</a>      'read_get_field': read the list of selected variables from the GUI get_field (SAME AS THE FIRST</li><li><a href="update_menu.html" class="code" title="function menu_str=update_menu(handle,strinput)">update_menu</a>  'update_menu': find an input string in a menu, add it to the menu at the penultimate position if it does not exist</li><li><a href="uvmat.html" class="code" title="function varargout = uvmat(varargin)">uvmat</a>     'uvmat': function associated with the GUI 'uvmat.fig' for images and data field visualization</li><li><a href="warndlg_uvmat.html" class="code" title="function hwarn=warndlg_uvmat(warntext,title)">warndlg_uvmat</a>  'warndlg_uvmat': display warning message (error, warning, confirmation) in a given figure</li></ul>
56This function is called by:
57<ul style="list-style-image:url(../matlabicon.gif)">
58<li><a href="series.html" class="code" title="function varargout = series(varargin)">series</a> 'series': master function associated to the GUI series.m for analysis field series</li><li><a href="uvmat.html" class="code" title="function varargout = uvmat(varargin)">uvmat</a>     'uvmat': function associated with the GUI 'uvmat.fig' for images and data field visualization</li></ul>
59<!-- crossreference -->
60
61<h2><a name="_subfunctions"></a>SUBFUNCTIONS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
62<ul style="list-style-image:url(../matlabicon.gif)">
63<li><a href="#_sub1" class="code">function get_field_OpeningFcn(hObject, eventdata, handles,filename,Field,haxes)</a></li><li><a href="#_sub2" class="code">function varargout = get_field_OutputFcn(hObject, eventdata, handles)</a></li><li><a href="#_sub3" class="code">function browse_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub4" class="code">function inputfile_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub5" class="code">function Field_input(eventdata,handles,Field)</a></li><li><a href="#_sub6" class="code">function abscissa_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub7" class="code">function ordinate_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub8" class="code">function vector_x_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub9" class="code">function vector_y_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub10" class="code">function scalar_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub11" class="code">function update_field(hObject, eventdata, handles,VarName)</a></li><li><a href="#_sub12" class="code">function update_UserData(handles)</a></li><li><a href="#_sub13" class="code">function plot_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub14" class="code">function PLOT(hget_field)</a></li><li><a href="#_sub15" class="code">function plot_histo_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub16" class="code">function peaklocking(handles)</a></li><li><a href="#_sub17" class="code">function variables_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub18" class="code">function check_1Dplot_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub19" class="code">function check_scalar_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub20" class="code">function check_vector_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub21" class="code">function mouse_up_gui(ggg,eventdata,handles)</a></li><li><a href="#_sub22" class="code">function ACTION_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub23" class="code">function HELP_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub24" class="code">function browse_fig(menu_handle)</a></li><li><a href="#_sub25" class="code">function list_fig_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub26" class="code">function VarIndex_y=name2index(cell_str,ListVarName)</a></li><li><a href="#_sub27" class="code">function vector_z_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub28" class="code">function coord_z_scalar_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub29" class="code">function coord_x_scalar_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub30" class="code">function coord_y_scalar_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub31" class="code">function coord_y_vectors_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub32" class="code">function coord_x_vectors_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub33" class="code">function vec_color_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub34" class="code">function MenuOpen_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub35" class="code">function MenuExport_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub36" class="code">function MenuBrowse_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub37" class="code">function MenuFile_1_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub38" class="code">function MenuFile_2_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub39" class="code">function MenuFile_3_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub40" class="code">function MenuFile_4_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub41" class="code">function MenuFile_5_Callback(hObject, eventdata, handles)</a></li><li><a href="#_sub42" class="code">function ExportField_Callback(hObject, eventdata, handles)</a></li></ul>
64<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
65<div class="fragment"><pre>0001 <span class="comment">%'get_field': display variables and attributes from a Netcdf file, and plot selected fields</span>
660002 <span class="comment">%------------------------------------------------------------------------</span>
670003 <span class="comment">%function varargout = get_field(varargin)</span>
680004 <span class="comment">% associated with the GUI get_field.fig</span>
690005 <span class="comment">%</span>
700006 <span class="comment">%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</span>
710007 <span class="comment">%  Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org.</span>
720008 <span class="comment">%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</span>
730009 <span class="comment">%     This file is part of the toolbox UVMAT.</span>
740010 <span class="comment">%</span>
750011 <span class="comment">%     UVMAT is free software; you can redistribute it and/or modify</span>
760012 <span class="comment">%     it under the terms of the GNU General Public License as published by</span>
770013 <span class="comment">%     the Free Software Foundation; either version 2 of the License, or</span>
780014 <span class="comment">%     (at your option) any later version.</span>
790015 <span class="comment">%</span>
800016 <span class="comment">%     UVMAT is distributed in the hope that it will be useful,</span>
810017 <span class="comment">%     but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
820018 <span class="comment">%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
830019 <span class="comment">%     GNU General Public License (file UVMAT/COPYING.txt) for more details.</span>
840020 <span class="comment">%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</span>
850021
860022 <a name="_sub0" href="#_subfunctions" class="code">function varargout = get_field(varargin)</a>
870023
880024 <span class="comment">% Last Modified by GUIDE v2.5 11-Nov-2009 18:59:57</span>
890025
900026 <span class="comment">% Begin initialization code - DO NOT EDIT</span>
910027 gui_Singleton = 0;
920028 gui_State = struct(<span class="string">'gui_Name'</span>,       mfilename, <span class="keyword">...</span>
930029                    <span class="string">'gui_Singleton'</span>,  gui_Singleton, <span class="keyword">...</span>
940030                    <span class="string">'gui_OpeningFcn'</span>, @<a href="#_sub1" class="code" title="subfunction get_field_OpeningFcn(hObject, eventdata, handles,filename,Field,haxes)">get_field_OpeningFcn</a>, <span class="keyword">...</span>
950031                    <span class="string">'gui_OutputFcn'</span>,  @<a href="#_sub2" class="code" title="subfunction varargout = get_field_OutputFcn(hObject, eventdata, handles)">get_field_OutputFcn</a>, <span class="keyword">...</span>
960032                    <span class="string">'gui_LayoutFcn'</span>,  [] , <span class="keyword">...</span>
970033                    <span class="string">'gui_Callback'</span>,   []);
980034 <span class="keyword">if</span> nargin &amp; isstr(varargin{1})
990035     gui_State.gui_Callback = str2func(varargin{1});
1000036 <span class="keyword">end</span>
1010037
1020038 <span class="keyword">if</span> nargout
1030039     [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
1040040 <span class="keyword">else</span>
1050041     gui_mainfcn(gui_State, varargin{:});
1060042 <span class="keyword">end</span>
1070043 <span class="comment">% End initialization code - DO NOT EDIT</span>
1080044
1090045
1100046 <span class="comment">% --- Executes just before get_field is made visible.</span>
1110047 <a name="_sub1" href="#_subfunctions" class="code">function get_field_OpeningFcn(hObject, eventdata, handles,filename,Field,haxes)</a>
1120048
1130049 set(handles.dimensions,<span class="string">'enable'</span>,<span class="string">'on'</span>)<span class="comment">% should be put by guide</span>
1140050 <a href="#_sub24" class="code" title="subfunction browse_fig(menu_handle)">browse_fig</a>(handles.list_fig)
1150051
1160052 <span class="comment">% Choose default command line output for get_field</span>
1170053 handles.output = hObject;
1180054
1190055 <span class="comment">% Update handles structure</span>
1200056 guidata(hObject, handles);
1210057 pathuvmat=fileparts(which(<span class="string">'uvmat'</span>));
1220058 addpath(fullfile(pathuvmat,<span class="string">'FIELD_FCT'</span>))
1230059 set(handles.attributes,<span class="string">'enable'</span>,<span class="string">'on'</span>)<span class="comment">% TO BE SET BY GUIDE</span>
1240060 set(hObject,<span class="string">'WindowButtonUpFcn'</span>,{@<a href="#_sub21" class="code" title="subfunction mouse_up_gui(ggg,eventdata,handles)">mouse_up_gui</a>,handles})<span class="comment">%set mouse click action function</span>
1250061 <span class="keyword">if</span> exist(<span class="string">'filename'</span>,<span class="string">'var'</span>)&amp; ischar(filename)
1260062     set(handles.inputfile,<span class="string">'String'</span>,filename)
1270063     <a href="#_sub4" class="code" title="subfunction inputfile_Callback(hObject, eventdata, handles)">inputfile_Callback</a>(hObject, eventdata, handles)
1280064 <span class="keyword">else</span>
1290065     set(handles.inputfile,<span class="string">'String'</span>,<span class="string">''</span>)
1300066     <span class="comment">%loads the information stored in prefdir to initiate the browser and the list of functions</span>
1310067     menu_str={<span class="string">'PLOT'</span>};<span class="comment">%list of functions included in 'get_field.m'</span>
1320068     <span class="comment">%menu_str(end)=[];%remove from the list the last option 'more...'</span>
1330069     path_get_field=which(<span class="string">'get_field'</span>);<span class="comment">%path of the function 'get_field'</span>
1340070     <span class="keyword">for</span> ilist=1:length(menu_str)
1350071         fct_path{ilist,1}=path_get_field;<span class="comment">%paths of the fuctions buil-in in 'get_field.m'</span>
1360072     <span class="keyword">end</span>
1370073      dir_perso=prefdir;
1380074      profil_perso=fullfile(dir_perso,<span class="string">'uvmat_perso.mat'</span>);
1390075      <span class="keyword">if</span> exist(profil_perso,<span class="string">'file'</span>)
1400076         <span class="comment">% menu={'PLOT';'raw2phys';'histogram';'FFT';'peaklocking'};</span>
1410077           h=load (profil_perso);
1420078          <span class="keyword">if</span> isfield(h,<span class="string">'get_field_fct'</span>) &amp;&amp; iscell(h.get_field_fct)
1430079              <span class="keyword">for</span> ilist=1:length(h.get_field_fct)
1440080                 [path,file]=fileparts(h.get_field_fct{ilist});
1450081                 fct_path=[fct_path; {path}];<span class="comment">%concatene the list of paths</span>
1460082                 menu_str=[menu_str; {file}];
1470083              <span class="keyword">end</span>
1480084             
1490085          <span class="keyword">end</span>
1500086      <span class="keyword">end</span>
1510087      menu_str=[menu_str;{<span class="string">'more...'</span>}];
1520088      set(handles.ACTION,<span class="string">'String'</span>,menu_str)
1530089      set(handles.ACTION,<span class="string">'UserData'</span>,fct_path)<span class="comment">% store the list of path in UserData of ACTION</span>
1540090      <span class="comment">% display the GUI for the default action 'check_files'</span>
1550091      <a href="#_sub22" class="code" title="subfunction ACTION_Callback(hObject, eventdata, handles)">ACTION_Callback</a>(hObject, eventdata, handles)
1560092 <span class="keyword">end</span>
1570093 <span class="comment">%                  menu=[menu;h.fct_get_field];</span>
1580094 <span class="comment">%                  menu=[menu;{'more...'}];</span>
1590095 <span class="comment">%                  fct_path=h.fct_path_get_field;</span>
1600096 <span class="comment">%                  set(handles.ACTION,'String',menu)</span>
1610097 <span class="comment">%                  set(handles.ACTION,'UserData',fct_path)</span>
1620098 <span class="comment">%                  for ipath=1:length(fct_path)</span>
1630099 <span class="comment">%                      if exist(fct_path{ipath},'dir')</span>
1640100 <span class="comment">%                         addpath(fct_path{ipath})</span>
1650101 <span class="comment">%                      end</span>
1660102 <span class="comment">%                  end</span>
1670103 <span class="comment">%          end</span>
1680104 <span class="comment">%      end</span>
1690105 <span class="comment">% end</span>
1700106 <span class="keyword">if</span> exist(<span class="string">'Field'</span>,<span class="string">'var'</span>) &amp; isstruct(Field)
1710107         <a href="#_sub5" class="code" title="subfunction Field_input(eventdata,handles,Field)">Field_input</a>(eventdata,handles,Field)
1720108         <span class="keyword">if</span> exist(<span class="string">'haxes'</span>,<span class="string">'var'</span>)
1730109             Field.PlotAxes=haxes;
1740110         <span class="keyword">end</span>
1750111     set(hObject,<span class="string">'UserData'</span>,Field);
1760112 <span class="keyword">end</span>
1770113
1780114
1790115
1800116
1810117
1820118
1830119 <span class="comment">%-----------------------------------------------------------</span>
1840120 <span class="comment">% --- Outputs from this function are returned to the command line.</span>
1850121 <a name="_sub2" href="#_subfunctions" class="code">function varargout = get_field_OutputFcn(hObject, eventdata, handles)</a>
1860122 varargout{1} = handles.output;
1870123
1880124 <span class="comment">%-----------------------------------------------------------</span>
1890125 <span class="comment">% --- Executes on button press in browse.</span>
1900126 <a name="_sub3" href="#_subfunctions" class="code">function browse_Callback(hObject, eventdata, handles)</a>
1910127
1920128
1930129
1940130
1950131 <span class="comment">%---------------------------------------------------------</span>
1960132 <a name="_sub4" href="#_subfunctions" class="code">function inputfile_Callback(hObject, eventdata, handles)</a>
1970133 inputfile=get(handles.inputfile,<span class="string">'String'</span>);
1980134 Field=<a href="nc2struct.html" class="code" title="function [Data,var_detect,ichoice]=nc2struct(nc,ListVarName)">nc2struct</a>(inputfile,[]);<span class="comment">% reads only the lists of fields, dimensions and attributes</span>
1990135 hfig=get(handles.inputfile,<span class="string">'parent'</span>);
2000136 set(hfig,<span class="string">'UserData'</span>,Field);
2010137 <a href="#_sub5" class="code" title="subfunction Field_input(eventdata,handles,Field)">Field_input</a>(eventdata,handles,Field);
2020138
2030139
2040140 <span class="comment">%---------------------------------------------------------</span>
2050141 <a name="_sub5" href="#_subfunctions" class="code">function Field_input(eventdata,handles,Field)</a>
2060142
2070143 <span class="keyword">if</span> isfield(Field,<span class="string">'ListDimName'</span>)
2080144     Tabcell(:,1)=Field.ListDimName;
2090145     <span class="keyword">for</span> iline=1:length(Field.ListDimName)
2100146         Tabcell{iline,2}=num2str(Field.DimValue(iline));
2110147     <span class="keyword">end</span>
2120148     Tabchar=<a href="cell2tab.html" class="code" title="function Tabchar=cell2tab(Tabcell,separator)">cell2tab</a>(Tabcell,<span class="string">'='</span>);
2130149     set(handles.dimensions,<span class="string">'String'</span>,Tabchar)
2140150 <span class="keyword">end</span>
2150151 <span class="keyword">if</span> ~isfield(Field,<span class="string">'ListVarName'</span>)
2160152     <span class="keyword">return</span>
2170153 <span class="keyword">end</span>
2180154 Txt=Field.ListVarName;
2190155 set(handles.variables,<span class="string">'Value'</span>,1)
2200156 set(handles.variables,<span class="string">'String'</span>,[{<span class="string">'*'</span>} Txt])
2210157 <a href="#_sub17" class="code" title="subfunction variables_Callback(hObject, eventdata, handles)">variables_Callback</a>(handles.variables,[], handles)
2220158 set(handles.abscissa,<span class="string">'String'</span>,[{<span class="string">''</span>} Txt ])
2230159 set(handles.ordinate,<span class="string">'String'</span>,Txt)
2240160 set(handles.vector_x,<span class="string">'String'</span>,[Txt ])
2250161 set(handles.vector_y,<span class="string">'String'</span>,[Txt ])
2260162 set(handles.vector_z,<span class="string">'String'</span>,[{<span class="string">''</span>} Txt ])
2270163 set(handles.vec_color,<span class="string">'String'</span>,[{<span class="string">''</span>} Txt ])
2280164 set(handles.coord_x_scalar,<span class="string">'String'</span>,[{<span class="string">''</span>} Txt ])
2290165 set(handles.coord_y_scalar,<span class="string">'String'</span>,[{<span class="string">''</span>} Txt ])
2300166 set(handles.coord_x_vectors,<span class="string">'String'</span>,[{<span class="string">''</span>} Txt ])
2310167 set(handles.coord_y_vectors,<span class="string">'String'</span>,[{<span class="string">''</span>} Txt ])
2320168 set(handles.coord_z_scalar,<span class="string">'String'</span>,[{<span class="string">''</span>} Txt ])
2330169 set(handles.coord_z_vectors,<span class="string">'String'</span>,[{<span class="string">''</span>} Txt ])
2340170 set(handles.scalar,<span class="string">'Value'</span>,1)
2350171 set(handles.scalar,<span class="string">'String'</span>, Txt )
2360172
2370173 [CellVarIndex,NbDim,VarType,errormsg]=<a href="find_field_indices.html" class="code" title="function [CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(Data)">find_field_indices</a>(Field);
2380174 <span class="keyword">if</span> ~isempty(errormsg) 
2390175     <a href="msgbox_uvmat.html" class="code" title="function varargout = msgbox_uvmat(varargin)">msgbox_uvmat</a>(<span class="string">'ERROR'</span>,[<span class="string">'error in get_field/Field_input/find_field_indices: '</span> errormsg])
2400176     <span class="keyword">return</span>
2410177 <span class="keyword">end</span> 
2420178 [maxdim,imax]=max(NbDim);
2430179   
2440180 <span class="keyword">if</span> maxdim&gt;=3
2450181     set(handles.vector_z,<span class="string">'Visible'</span>,<span class="string">'on'</span>)
2460182     set(handles.vector_z,<span class="string">'String'</span>,[{<span class="string">''</span>} Txt ])
2470183     set(handles.coord_z_vectors,<span class="string">'Visible'</span>,<span class="string">'on'</span>)
2480184     set(handles.coord_z_vectors,<span class="string">'String'</span>,[{<span class="string">''</span>} Txt ])
2490185     set(handles.coord_z_scalar,<span class="string">'Visible'</span>,<span class="string">'on'</span>)
2500186     set(handles.coord_z_scalar,<span class="string">'String'</span>,[{<span class="string">''</span>} Txt ])
2510187 <span class="keyword">else</span>
2520188     set(handles.vector_z,<span class="string">'Visible'</span>,<span class="string">'off'</span>)
2530189     set(handles.coord_z_vectors,<span class="string">'Visible'</span>,<span class="string">'off'</span>)
2540190     set(handles.coord_z_scalar,<span class="string">'Visible'</span>,<span class="string">'off'</span>)
2550191 <span class="keyword">end</span>
2560192 <span class="keyword">if</span> maxdim&gt;=2
2570193     set(handles.check_1Dplot,<span class="string">'Value'</span>,0)
2580194     <span class="keyword">if</span> ~isempty(VarType{imax}.vector_x) &amp;&amp; ~isempty(VarType{imax}.vector_y)     
2590195         set(handles.check_vector,<span class="string">'Value'</span>,1)
2600196         set(handles.vector_x,<span class="string">'Value'</span>,VarType{imax}.vector_x)
2610197         set(handles.vector_y,<span class="string">'Value'</span>,VarType{imax}.vector_y)
2620198         set(handles.check_scalar,<span class="string">'Value'</span>,0)
2630199     <span class="keyword">else</span>
2640200         set(handles.check_scalar,<span class="string">'Value'</span>,1)
2650201         set(handles.check_vector,<span class="string">'Value'</span>,0)
2660202         <span class="keyword">if</span> isfield(VarType{imax},<span class="string">'scalar'</span>) &amp;&amp; length(VarType{imax}.scalar)&gt;=1
2670203             set(handles.scalar,<span class="string">'Value'</span>,VarType{imax}.scalar(1))
2680204         <span class="keyword">end</span>
2690205     <span class="keyword">end</span>
2700206     <a href="#_sub18" class="code" title="subfunction check_1Dplot_Callback(hObject, eventdata, handles)">check_1Dplot_Callback</a>(handles.check_1Dplot, eventdata, handles)
2710207     <a href="#_sub19" class="code" title="subfunction check_scalar_Callback(hObject, eventdata, handles)">check_scalar_Callback</a>(handles.check_scalar, eventdata, handles)
2720208     <a href="#_sub20" class="code" title="subfunction check_vector_Callback(hObject, eventdata, handles)">check_vector_Callback</a>(handles.check_vector, eventdata, handles)
2730209 <span class="keyword">end</span>
2740210
2750211
2760212
2770213 <span class="comment">%----------------------------------------------------------------------</span>
2780214 <span class="comment">% --- Executes on selection change in abscissa.</span>
2790215 <a name="_sub6" href="#_subfunctions" class="code">function abscissa_Callback(hObject, eventdata, handles)</a>
2800216  hselect_field=get(handles.inputfile,<span class="string">'parent'</span>);
2810217  Field=get(hselect_field,<span class="string">'UserData'</span>);<span class="comment">%current input field</span>
2820218  xdispindex=get(handles.abscissa,<span class="string">'Value'</span>);<span class="comment">%index in the list of abscissa</span>
2830219 <span class="comment">% test_2D=get(handles.check_vector,'Value');% =1 for vector fields</span>
2840220 <span class="comment">% test_scalar=get(handles.check_scalar,'Value');% =1 for scalar fields</span>
2850221 <span class="comment">%if isequal(xdispindex,1)% blank selection, no selected variable for abscissa</span>
2860222 <span class="comment">%     Txt=Field.ListVarName;</span>
2870223 <span class="comment">%     set(handles.ordinate,'String',[{''} Txt ])% display all the varaibles in the list of ordinates</span>
2880224 <span class="comment">%     xindex=[];</span>
2890225 <span class="comment">% else</span>
2900226      xlist=get(handles.abscissa,<span class="string">'String'</span>);<span class="comment">%list of abscissa</span>
2910227      xname=xlist{xdispindex}; <span class="comment">%selected variable name</span>
2920228      xindex=<a href="#_sub26" class="code" title="subfunction VarIndex_y=name2index(cell_str,ListVarName)">name2index</a>(xname,Field.ListVarName); <span class="comment">%index of the selection in the total list of variables</span>
2930229      <span class="keyword">if</span> ~isempty(xindex)
2940230         set(handles.variables,<span class="string">'Value'</span>,xindex+1)
2950231         <a href="#_sub17" class="code" title="subfunction variables_Callback(hObject, eventdata, handles)">variables_Callback</a>(hObject, eventdata, handles)
2960232      <span class="keyword">end</span>
2970233 <span class="comment">%     set(handles.variables,'Value',xindex+1)%outline  in the list of variables</span>
2980234 <span class="comment">%     variables_Callback(hObject, eventdata, handles)  %display properties of the variable (dim, attributes)</span>
2990235 <span class="comment">%     if  ~test_2D &amp;  ~test_scalar% look for possible varaibles to plot in ordinate</span>
3000236 <span class="comment">%         index=Field.VarDimIndex{xindex};%dimension indices of the variable selected for abscissa</span>
3010237 <span class="comment">%         VarIndex=[];</span>
3020238 <span class="comment">%         for ilist=1:length(Field.VarDimIndex)%detect</span>
3030239 <span class="comment">%             index_i=Field.VarDimIndex{ilist};</span>
3040240 <span class="comment">%             if ~isempty(index_i)</span>
3050241 <span class="comment">%                 if isequal(index_i(1),index(1))%if the first dimension of the variable coincide with the selected one, plot is possible</span>
3060242 <span class="comment">%                     VarIndex=[VarIndex ilist];</span>
3070243 <span class="comment">%                 end</span>
3080244 <span class="comment">%             end</span>
3090245 <span class="comment">%         end</span>
3100246 <span class="comment">% %         set(handles.ordinate,'Value',1)</span>
3110247 <span class="comment">%         set(handles.ordinate,'String',Field.ListVarName(VarIndex))</span>
3120248 <span class="comment">%     end</span>
3130249 <span class="comment">% end</span>
3140250 <span class="comment">%</span>
3150251 <span class="comment">% update_UserData(handles)</span>
3160252
3170253 <span class="comment">%----------------------------------------------------------</span>
3180254 <a name="_sub7" href="#_subfunctions" class="code">function ordinate_Callback(hObject, eventdata, handles)</a>
3190255 <span class="comment">%update_field(hObject, eventdata, handles)</span>
3200256 <span class="comment">% A REVOIR</span>
3210257 hselect_field=get(handles.inputfile,<span class="string">'parent'</span>);
3220258 Field=get(hselect_field,<span class="string">'UserData'</span>);
3230259 <span class="comment">% xindex=get(handles.abscissa,'Value');</span>
3240260 list=get(handles.ordinate,<span class="string">'String'</span>);
3250261 yindex=get(handles.ordinate,<span class="string">'Value'</span>);
3260262 yindex=<a href="#_sub26" class="code" title="subfunction VarIndex_y=name2index(cell_str,ListVarName)">name2index</a>(list{yindex(1)},Field.ListVarName);
3270263 <span class="keyword">if</span> ~isempty(yindex)
3280264     set(handles.variables,<span class="string">'Value'</span>,yindex+1)
3290265     <a href="#_sub17" class="code" title="subfunction variables_Callback(hObject, eventdata, handles)">variables_Callback</a>(hObject, eventdata, handles)
3300266 <span class="keyword">end</span>
3310267 [CellVarIndex,NbDim,VarType,errormsg]=<a href="find_field_indices.html" class="code" title="function [CellVarIndex,NbDim,VarType,errormsg]=find_field_indices(Data)">find_field_indices</a>(Field);
3320268 <span class="keyword">for</span> icell=1:numel(CellVarIndex)
3330269     VarIndex=CellVarIndex{icell};
3340270     <span class="keyword">if</span> ~isempty(find(VarIndex==yindex)) &amp;&amp; (isempty(VarType{icell}.coord_x)||~isequal(VarType{icell}.coord_x,VarIndex))
3350271         cell_select=icell;
3360272         <span class="keyword">break</span>
3370273     <span class="keyword">end</span>
3380274 <span class="keyword">end</span>
3390275
3400276 val=get(handles.abscissa,<span class="string">'Value'</span>);
3410277 set(handles.abscissa,<span class="string">'Value'</span>,min(val,2));
3420278 coord_x_index=VarType{cell_select}.coord;
3430279 coord_x_index=coord_x_index(find(coord_x_index));
3440280 set(handles.abscissa,<span class="string">'String'</span>,[{<span class="string">''</span>}; (Field.ListVarName(coord_x_index))'; (Field.ListVarName(VarIndex))'])
3450281 <span class="comment">% Field.VarIndex.y=yindex;</span>
3460282 <span class="comment">% set(hselect_field,'UserData',Field);</span>
3470283 <span class="comment">%update_UserData(handles)</span>
3480284
3490285 <span class="comment">%----------------------------------------------------------</span>
3500286 <span class="comment">% --- Executes on selection change in vector_y.</span>
3510287 <a name="_sub8" href="#_subfunctions" class="code">function vector_x_Callback(hObject, eventdata, handles)</a>
3520288 Aindex=get(handles.vector_x,<span class="string">'Value'</span>);
3530289 Astring=get(handles.vector_x,<span class="string">'String'</span>);
3540290 VarName=Astring{Aindex};
3550291 <span class="comment">%update_field(hObject, eventdata, handles,VarName)</span>
3560292
3570293 <span class="comment">%----------------------------------------------------------</span>
3580294 <span class="comment">% --- Executes on selection change in vector_y.</span>
3590295 <a name="_sub9" href="#_subfunctions" class="code">function vector_y_Callback(hObject, eventdata, handles)</a>
3600296 Aindex=get(handles.vector_y,<span class="string">'Value'</span>);
3610297 Astring=get(handles.vector_y,<span class="string">'String'</span>);
3620298 VarName=Astring{Aindex};
3630299 <span class="comment">%update_field(hObject, eventdata, handles,VarName)</span>
3640300
3650301 <span class="comment">%-------------------------------------------------------</span>
3660302 <span class="comment">% --- Executes on selection change in vector_y.</span>
3670303 <a name="_sub10" href="#_subfunctions" class="code">function scalar_Callback(hObject, eventdata, handles)</a>
3680304
3690305 Aindex=get(handles.scalar,<span class="string">'Value'</span>);
3700306 Astring=get(handles.scalar,<span class="string">'String'</span>);
3710307 VarName=Astring{Aindex};
3720308 <span class="comment">%update_field(hObject, eventdata, handles,VarName)</span>
3730309
3740310 <span class="comment">%---------------------------------</span>
3750311 <a name="_sub11" href="#_subfunctions" class="code">function update_field(hObject, eventdata, handles,VarName)</a>
3760312 <span class="comment">% VarName= input variable name for scalar or vector plots</span>
3770313 <span class="comment">%if ischar(VarName)</span>
3780314 hselect_field=get(handles.inputfile,<span class="string">'parent'</span>);
3790315 Field=get(hselect_field,<span class="string">'UserData'</span>);
3800316 ivar_sel=[];<span class="comment">%default</span>
3810317 <span class="keyword">for</span> ivar=1:length(Field.ListVarName)<span class="comment">%detect</span>
3820318     <span class="keyword">if</span> isequal(Field.ListVarName{ivar},VarName)
3830319         ivar_sel=ivar; <span class="comment">%ivar_sel = index of the input variable in the list ListVarName</span>
3840320         <span class="keyword">break</span>
3850321     <span class="keyword">end</span>
3860322 <span class="keyword">end</span>
3870323 <span class="keyword">if</span> isempty(ivar_sel)
3880324     <span class="keyword">return</span>
3890325 <span class="keyword">end</span>
3900326 set(handles.variables,<span class="string">'Value'</span>,ivar_sel+1)<span class="comment">%select the corresponding item in the displayed  list 'variables'</span>
3910327 <a href="#_sub17" class="code" title="subfunction variables_Callback(hObject, eventdata, handles)">variables_Callback</a>(hObject, eventdata, handles)<span class="comment">%show the dimensions and attributes of the input variable</span>
3920328
3930329 index=Field.VarDimIndex{ivar_sel};<span class="comment">%dimension indices of the input variable</span>
3940330 DimValue=Field.DimValue(index);<span class="comment">%dimension values of the input variable</span>
3950331 ind_1=find(DimValue==1);
3960332 index(ind_1)=[];<span class="comment">%Mremove singletons</span>
3970333
3980334
3990335 <span class="comment">% detect possible variables for abscissa and ordinate</span>
4000336 VarIndex=[];<span class="comment">%initiate list of selected variable indices</span>
4010337 ind_coordvar=[]; <span class="comment">%initiate list of coordinate variables</span>
4020338 <span class="keyword">for</span> ilist=1:length(Field.VarDimIndex)
4030339     <span class="keyword">if</span> ~isequal(ilist,ivar_sel)       
4040340         index_i=Field.VarDimIndex{ilist};<span class="comment">%indices of dimensions associated with variable #ilist</span>
4050341         <span class="keyword">if</span> length(index_i)&gt;1
4060342             DimValue=Field.DimValue(index_i);
4070343             ind_1=find(DimValue==1);
4080344             index_i(ind_1)=[];<span class="comment">%Mremove singletons</span>
4090345             <span class="keyword">if</span> isequal(index,index_i)
4100346                 VarIndex=[VarIndex ilist]; <span class="comment">%selected variable withb the same dimensions of the input variable</span>
4110347             <span class="keyword">end</span>
4120348         <span class="keyword">else</span>
4130349             idim=find(index==index_i(1));
4140350             <span class="keyword">if</span> ~isempty(idim)
4150351                  VarIndex=[VarIndex ilist]; <span class="comment">%possible dimension variable</span>
4160352                  <span class="keyword">if</span> isequal(Field.ListDimName{index_i(1)},Field.ListVarName{ilist})
4170353                      ind_coordvar=[ind_coordvar length(VarIndex)];
4180354                  <span class="keyword">end</span>
4190355             <span class="keyword">end</span>
4200356         <span class="keyword">end</span>
4210357     <span class="keyword">end</span>
4220358 <span class="keyword">end</span>
4230359 <span class="comment">% val=get(handles.abscissa,'Value');</span>
4240360 <span class="comment">% if val&gt;length(Field.ListVarName(VarIndex))+1</span>
4250361 <span class="comment">%     set(handles.abscissa,'Value',length(Field.ListVarName(VarIndex))+1)</span>
4260362 <span class="comment">% end</span>
4270363 <span class="comment">% val=get(handles.ordinate,'Value');</span>
4280364 <span class="comment">% if val&gt;length(Field.ListVarName(VarIndex))+1</span>
4290365 <span class="comment">%     set(handles.abscissa,'Value',length(Field.ListVarName(VarIndex))+1)</span>
4300366 <span class="comment">% end</span>
4310367 <span class="comment">% val=get(handles.coord_z_vectors_scalar,'Value');</span>
4320368 <span class="comment">% if val&gt;length(Field.ListVarName(VarIndex))+1</span>
4330369 <span class="comment">%     set(handles.abscissa,'Value',length(Field.ListVarName(VarIndex))+1)</span>
4340370 <span class="comment">% end</span>
4350371 set(handles.abscissa,<span class="string">'Value'</span>,1)<span class="comment">%default</span>
4360372 set(handles.ordinate,<span class="string">'Value'</span>,1)<span class="comment">%default</span>
4370373 set(handles.coord_z_scalar,<span class="string">'Value'</span>,1)<span class="comment">%default</span>
4380374 set(handles.abscissa,<span class="string">'String'</span>,[{<span class="string">''</span>} Field.ListVarName(VarIndex) ])
4390375 set(handles.ordinate,<span class="string">'String'</span>,[{<span class="string">''</span>} Field.ListVarName(VarIndex) ])
4400376 set(handles.coord_z_scalar,<span class="string">'String'</span>,[{<span class="string">''</span>} Field.ListVarName(VarIndex) ])
4410377 <span class="keyword">if</span> length(ind_coordvar)&gt;=1
4420378     set(handles.abscissa,<span class="string">'Value'</span>,ind_coordvar(1)+1)
4430379 <span class="keyword">elseif</span> length(index)==1 &amp;&amp; length(VarIndex)&gt;=1
4440380     set(handles.abscissa,<span class="string">'Value'</span>,2)
4450381 <span class="keyword">end</span>
4460382 <span class="keyword">if</span> length(ind_coordvar)&gt;=2
4470383     set(handles.ordinate,<span class="string">'Value'</span>,ind_coordvar(2)+1)
4480384 <span class="keyword">elseif</span> length(index)==1 &amp;&amp; length(VarIndex)&gt;=2
4490385     set(handles.ordinate,<span class="string">'Value'</span>,3)
4500386 <span class="keyword">end</span>
4510387 <span class="keyword">if</span> length(ind_coordvar)&gt;=3
4520388     set(handles.coord_z_scalar,<span class="string">'Value'</span>,ind_coordvar(3)+1)
4530389 <span class="keyword">elseif</span> length(index)==1 &amp;&amp; length(VarIndex)&gt;=3
4540390     set(handles.coord_z_scalar,<span class="string">'Value'</span>,4)
4550391 <span class="keyword">end</span>
4560392
4570393 <span class="comment">%---------------------------------------------------------</span>
4580394 <span class="comment">% update the UserData Field for use of the selected variables outsde get_field (taken from plot_Callback)</span>
4590395 <a name="_sub12" href="#_subfunctions" class="code">function update_UserData(handles)</a>
4600396 <span class="comment">%---------------------------------------------------------</span>
4610397 <span class="keyword">return</span>
4620398 <span class="comment">% global SubField</span>
4630399 hselect_field=get(handles.inputfile,<span class="string">'parent'</span>);<span class="comment">%handle of the get_field interface</span>
4640400 Field=get(hselect_field,<span class="string">'UserData'</span>);<span class="comment">% read the current field Structure in the get_field interface</span>
4650401 <span class="keyword">if</span> isfield(Field,<span class="string">'VarAttribute'</span>)
4660402     VarAttribute=Field.VarAttribute;
4670403 <span class="keyword">else</span>
4680404     VarAttribute={};
4690405 <span class="keyword">end</span>
4700406
4710407
4720408 <span class="comment">% select the indices of field variables for 2D plots</span>
4730409 test_check_1Dplot=get(handles.check_1Dplot,<span class="string">'Value'</span>);
4740410 test_scalar=get(handles.check_scalar,<span class="string">'Value'</span>);
4750411 test_vector=get(handles.check_vector,<span class="string">'Value'</span>);
4760412
4770413 <span class="comment">%transform if needed (calibration)</span>
4780414 list=get(handles.menu_coord,<span class="string">'String'</span>);
4790415 index=get(handles.menu_coord,<span class="string">'Value'</span>);
4800416 transform=list{index};
4810417 <span class="keyword">if</span> ~isequal(transform,<span class="string">''</span>)
4820418     Field=feval(transform,Field);
4830419 <span class="keyword">end</span>
4840420 VarIndex.u=[];
4850421 VarIndex.v=[];
4860422 VarIndex.w=[];
4870423 VarIndex.A=[];
4880424 VarIndex_tot=[];
4890425 iuA=[];
4900426 <span class="keyword">if</span> test_scalar
4910427     Astring=get(handles.scalar,<span class="string">'String'</span>);
4920428     Aindex=get(handles.scalar,<span class="string">'Value'</span>);<span class="comment">%selected indices in the ordinate listbox</span>
4930429     list_var=Astring(Aindex);
4940430     VarIndex.A=<a href="#_sub26" class="code" title="subfunction VarIndex_y=name2index(cell_str,ListVarName)">name2index</a>(list_var,Field.ListVarName);<span class="comment">%index of the variable A in ListVarName</span>
4950431     VarIndex_tot= [VarIndex_tot VarIndex.A];
4960432     DimIndex=Field.VarDimIndex{VarIndex.A};<span class="comment">%dimension indices of the variable</span>
4970433     DimValue=Field.DimValue(DimIndex);
4980434     ind=find(DimValue==1);
4990435     DimIndex(ind)=[];<span class="comment">%Mremove singleton</span>
5000436 <span class="keyword">end</span>
5010437 <span class="keyword">if</span> test_vector
5020438     Ustring=get(handles.vector_x,<span class="string">'String'</span>);
5030439     Uindex=get(handles.vector_x,<span class="string">'Value'</span>); <span class="comment">%selected indices in the ordinate listbox</span>
5040440     list_var=Ustring{Uindex};<span class="comment">%name of the selected scalar</span>
5050441     VarIndex.u=<a href="#_sub26" class="code" title="subfunction VarIndex_y=name2index(cell_str,ListVarName)">name2index</a>(list_var,Field.ListVarName);
5060442     Vstring=get(handles.vector_y,<span class="string">'String'</span>);
5070443     Vindex=get(handles.vector_y,<span class="string">'Value'</span>); <span class="comment">%selected indices in the ordinate listbox</span>
5080444     list_var=Ustring{Vindex};<span class="comment">%name of the selected scalar</span>
5090445     VarIndex.v=<a href="#_sub26" class="code" title="subfunction VarIndex_y=name2index(cell_str,ListVarName)">name2index</a>(list_var,Field.ListVarName);
5100446     <span class="keyword">if</span> isequal(VarIndex.u,VarIndex.A)|isequal(VarIndex.v,VarIndex.A)
5110447         iuA=VarIndex.A; <span class="comment">%same variable used for vector and scalar</span>
5120448         VarIndex_tot(iuA)=[];
5130449     <span class="keyword">end</span>
5140450     VarIndex_tot=[VarIndex_tot VarIndex.u VarIndex.v];
5150451     <span class="comment">%dimensions</span>
5160452     DimIndex_u=Field.VarDimIndex{VarIndex.u};<span class="comment">%dimension indices of the variable</span>
5170453     DimValue=Field.DimValue(DimIndex_u);
5180454     ind=find(DimValue==1);
5190455     DimIndex_u(ind)=[];<span class="comment">%Mremove singleton</span>
5200456     DimIndex_v=Field.VarDimIndex{VarIndex.v};<span class="comment">%dimension indices of the variable</span>
5210457     DimValue=Field.DimValue(DimIndex_v);
5220458     ind=find(DimValue==1);
5230459     DimIndex_v(ind)=[];<span class="comment">%Mremove singleton</span>
5240460     <span class="keyword">if</span> ~isequal(DimIndex_u,DimIndex_v)
5250461         <a href="warndlg_uvmat.html" class="code" title="function hwarn=warndlg_uvmat(warntext,title)">warndlg_uvmat</a>(<span class="string">'inconsistent dimensions for u and v'</span>,<span class="string">'ERROR'</span>)
5260462         set(handles.vector_y,<span class="string">'Value'</span>,1);
5270463         <span class="keyword">return</span>
5280464     <span class="keyword">elseif</span>  test_scalar &amp; ~isequal(DimIndex_u,DimIndex)
5290465          <a href="warndlg_uvmat.html" class="code" title="function hwarn=warndlg_uvmat(warntext,title)">warndlg_uvmat</a>(<span class="string">'inconsistent dimensions for vector and scalar represented as vector color'</span>,<span class="string">'ERROR'</span>)
5300466          set(handles.scalar,<span class="string">'Value'</span>,1);
5310467          <span class="keyword">return</span>
5320468     <span class="keyword">end</span>
5330469     DimIndex=DimIndex_u;
5340470     <span class="comment">%TODO possibility of selecting 3 times the same variable for u, v, w components</span>
5350471 <span class="keyword">end</span>
5360472
5370473
5380474 <span class="comment">% select the variable  index (or indices) for z coordinates</span>
5390475 test_grid=0;
5400476 <span class="keyword">if</span> test_scalar | test_vector
5410477     nbdim=length(DimIndex);
5420478     <span class="keyword">if</span> nbdim &gt; 3
5430479         <a href="warndlg_uvmat.html" class="code" title="function hwarn=warndlg_uvmat(warntext,title)">warndlg_uvmat</a>(<span class="string">'array with more than three dimensions, not supported'</span>,<span class="string">'ERROR'</span>)
5440480         <span class="keyword">return</span>
5450481     <span class="keyword">else</span>
5460482         perm_ind=[1:nbdim];
5470483     <span class="keyword">end</span>
5480484     <span class="keyword">if</span> nbdim==3
5490485         zstring=get(handles.coord_z_vectors_scalar,<span class="string">'String'</span>);
5500486         zindex=get(handles.coord_z_vectors_scalar,<span class="string">'Value'</span>); <span class="comment">%selected indices in the ordinate listbox</span>
5510487         list_var=zstring(zindex);
5520488         VarIndex_z=<a href="#_sub26" class="code" title="subfunction VarIndex_y=name2index(cell_str,ListVarName)">name2index</a>(list_var,Field.ListVarName);<span class="comment">%index of the selected variable</span>
5530489         <span class="keyword">if</span> isequal(VarIndex.A,VarIndex_z)|isequal(VarIndex.u,VarIndex_z)|isequal(VarIndex.v,VarIndex_z)|isequal(VarIndex.w,VarIndex_z)
5540490             <span class="keyword">if</span> zindex ~= 1
5550491                 set(handles.coord_z_vectors_scalar,<span class="string">'Value'</span>,1)<span class="comment">%ordinate cannot be the same as scalar or vector components</span>
5560492                 <span class="keyword">return</span>
5570493             <span class="keyword">end</span>
5580494         <span class="keyword">else</span> 
5590495             VarIndex_tot=[VarIndex_tot VarIndex_z];
5600496             DimIndex_z=Field.VarDimIndex{VarIndex_z};
5610497             DimValue=Field.DimValue(DimIndex_z);
5620498             ind=find(DimValue==1);         
5630499             DimIndex_z(ind)=[];<span class="comment">%Mremove singleton</span>
5640500             <span class="keyword">if</span> isequal(DimIndex_z,DimIndex)
5650501                 VarAttribute{VarIndex_z}.Role=<span class="string">'coord_z'</span>;<span class="comment">%unstructured coordinates</span>
5660502             <span class="keyword">elseif</span> length(DimIndex_z)==1
5670503                 VarAttribute{VarIndex_z}.Role=Field.ListDimName{DimIndex_z};  <span class="comment">%dimension variable</span>
5680504                 ind_z=find(DimIndex==DimIndex_z(1));
5690505                 perm_ind(ind_z)=1;
5700506                 test_grid=1;
5710507             <span class="keyword">else</span>
5720508                 <a href="warndlg_uvmat.html" class="code" title="function hwarn=warndlg_uvmat(warntext,title)">warndlg_uvmat</a>(<span class="string">'multiple dimensions for the z coordinate'</span>,<span class="string">'ERROR'</span>)
5730509                 <span class="keyword">return</span>
5740510             <span class="keyword">end</span>
5750511         <span class="keyword">end</span>
5760512 <span class="comment">%         if ~isempty(VarIndex_z)</span>
5770513 <span class="comment">%             DimIndex_z=Field.VarDimIndex{VarIndex_z};%dimension indices of the variable</span>
5780514 <span class="comment">%             if length(DimIndex_z)==1 &amp; nbdim==3 %dimension variable</span>
5790515 <span class="comment">%                 VarAttribute{VarIndex_z}.Role=Field.ListDimName{DimIndex_z};</span>
5800516 <span class="comment">%                 ind_z=find(DimIndex==DimIndex_z(1));</span>
5810517 <span class="comment">%                 perm_ind(ind_z)=1;</span>
5820518 <span class="comment">%                 test_grid=1;</span>
5830519 <span class="comment">%             end</span>
5840520 <span class="comment">%         end</span>
5850521     <span class="keyword">end</span>
5860522 <span class="keyword">end</span>
5870523
5880524 <span class="comment">% select the variable  index (or indices) for ordinate</span>
5890525 ystring=get(handles.ordinate,<span class="string">'String'</span>);
5900526 yindex=get(handles.ordinate,<span class="string">'Value'</span>); <span class="comment">%selected indices in the ordinate listbox</span>
5910527 list_var=ystring(yindex);
5920528 VarIndex.y=<a href="#_sub26" class="code" title="subfunction VarIndex_y=name2index(cell_str,ListVarName)">name2index</a>(list_var,Field.ListVarName);
5930529 <span class="keyword">if</span> isequal(VarIndex.A,VarIndex.y)
5940530     set(handles.coord_y_scalar,<span class="string">'Value'</span>,1)
5950531 <span class="keyword">elseif</span> isequal(VarIndex.u,VarIndex.y)||isequal(VarIndex.v,VarIndex.y)||isequal(VarIndex.w,VarIndex.y)
5960532    set(handles.coord_y_vectors,<span class="string">'Value'</span>,1)<span class="comment">%ordinate cannot be the same as scalar or vector components</span>
5970533 <span class="keyword">else</span>
5980534     <span class="keyword">for</span> ivar=1:length(VarIndex.y)
5990535         VarAttribute{VarIndex.y(ivar)}.Role=<span class="string">'coord_y'</span>;
6000536     <span class="keyword">end</span>
6010537     VarIndex_tot=[VarIndex_tot VarIndex.y];
6020538 <span class="keyword">end</span>
6030539 <span class="keyword">if</span> (test_scalar | test_vector) &amp;  ~isempty(VarIndex.y)
6040540     DimIndex_y=Field.VarDimIndex{VarIndex.y};<span class="comment">%dimension indices of the variable</span>
6050541     <span class="keyword">if</span> length(DimIndex_y)==1
6060542         ind_y=find(DimIndex==DimIndex_y(1));
6070543         test_grid=1;
6080544         <span class="keyword">if</span> nbdim==3
6090545             VarAttribute{VarIndex.y}.Role=Field.ListDimName{DimIndex_y};
6100546             perm_ind(ind_y)=2;
6110547         <span class="keyword">elseif</span> nbdim==2
6120548             VarAttribute{VarIndex.y}.Role=Field.ListDimName{DimIndex_y};
6130549              perm_ind(ind_y)=1;
6140550         <span class="keyword">end</span>
6150551     <span class="keyword">elseif</span> test_grid
6160552         <a href="warndlg_uvmat.html" class="code" title="function hwarn=warndlg_uvmat(warntext,title)">warndlg_uvmat</a>(<span class="string">'the dimension of the y coordinate variable should be 1'</span>,<span class="string">'ERROR'</span>)   
6170553     <span class="keyword">end</span>
6180554 <span class="keyword">end</span>
6190555
6200556 <span class="comment">%select the variable index for the abscissa</span>
6210557 xstring=get(handles.abscissa,<span class="string">'String'</span>);
6220558 xindex=get(handles.abscissa,<span class="string">'Value'</span>);
6230559 list_var=xstring(xindex);
6240560 VarIndex.x=<a href="#_sub26" class="code" title="subfunction VarIndex_y=name2index(cell_str,ListVarName)">name2index</a>(list_var,Field.ListVarName);<span class="comment">%var index corresponding to var name list_var</span>
6250561 <span class="keyword">if</span> length(VarIndex.x)==1   
6260562     DimIndex_x=Field.VarDimIndex{VarIndex.x};
6270563     DimValue=Field.DimValue(DimIndex_x);
6280564     ind=find(DimValue==1);         
6290565     DimIndex_x(ind)=[];<span class="comment">%Mremove singleton</span>
6300566     VarAttribute{VarIndex.x}.Role=Field.ListDimName{DimIndex_x};  <span class="comment">%dimension variable</span>
6310567 <span class="comment">%     VarAttribute{VarIndex.x}.Role='coord_x';%default (may be modified)</span>
6320568     index_detect=find(VarIndex_tot==VarIndex.x);
6330569 <span class="keyword">else</span>
6340570     index_detect=[];<span class="comment">%coord x variable not already used</span>
6350571 <span class="keyword">end</span>
6360572 <span class="keyword">if</span> isempty(index_detect)
6370573     VarIndex_tot=[VarIndex_tot VarIndex.x];
6380574 <span class="keyword">elseif</span> ~test_check_1Dplot
6390575     VarIndex.x=[];
6400576     set(handles.abscissa,<span class="string">'Value'</span>,1)<span class="comment">%vchosen abscissa already chosen, suppres it as abscissa</span>
6410577 <span class="keyword">end</span>
6420578
6430579 <span class="keyword">if</span> (test_scalar | test_vector) &amp;  ~isempty(VarIndex.x)
6440580     DimIndex_x=Field.VarDimIndex{VarIndex.x};<span class="comment">%dimension indices of the variable</span>
6450581     <span class="keyword">if</span> length(DimIndex_x)==1
6460582         ind_x=find(DimIndex==DimIndex_x(1));
6470583         <span class="keyword">if</span> nbdim==3
6480584             <span class="comment">%VarAttribute{VarIndex.x}.Role=Field.ListDimName{DimIndex_x};</span>
6490585             perm_ind(ind_x)=3;
6500586         <span class="keyword">elseif</span> nbdim==2
6510587             <span class="comment">%VarAttribute{VarIndex.x}.Role=Field.ListDimName{DimIndex_x};</span>
6520588              perm_ind(ind_x)=2;
6530589         <span class="keyword">end</span>
6540590         <span class="keyword">if</span> isequal(perm_ind,1:nbdim)
6550591             test_grid=0;
6560592         <span class="keyword">end</span>
6570593         DimIndex=DimIndex(perm_ind);
6580594     <span class="keyword">elseif</span> test_grid
6590595         <a href="warndlg_uvmat.html" class="code" title="function hwarn=warndlg_uvmat(warntext,title)">warndlg_uvmat</a>(<span class="string">'the dimension of the x coordinate variable should be 1'</span>,<span class="string">'ERROR'</span>)   
6600596     <span class="keyword">end</span>
6610597     <span class="keyword">if</span> isequal(DimIndex_x,DimIndex)
6620598                 VarAttribute{VarIndex.x}.Role=<span class="string">'coord_x'</span>;<span class="comment">%unstructured coordinates</span>
6630599     <span class="keyword">end</span>
6640600 <span class="keyword">end</span>
6650601
6660602 <span class="comment">%defined the selected sub-field SubField</span>
6670603 SubField.ListGlobalAttribute{1}=<span class="string">'InputFile'</span>;
6680604 SubField.InputFile=get(handles.inputfile,<span class="string">'String'</span>);
6690605 SubField.ListDimName=Field.ListDimName;
6700606 SubField.DimValue=Field.DimValue;
6710607 SubField.ListVarName=Field.ListVarName(VarIndex_tot);
6720608 SubField.VarDimIndex=Field.VarDimIndex(VarIndex_tot);
6730609
6740610 testperm=0;
6750611 testattr=0;
6760612 <span class="keyword">for</span> ivar=VarIndex.u
6770613     VarAttribute{ivar}.Role=<span class="string">'vector_x'</span>;
6780614     testattr=1;
6790615     <span class="keyword">if</span> test_grid
6800616         VarDimIndex{ivar}=DimIndex; <span class="comment">%permute dimensions</span>
6810617         testperm=1;
6820618     <span class="keyword">end</span>
6830619 <span class="keyword">end</span>
6840620 <span class="keyword">for</span> ivar=VarIndex.v
6850621     VarAttribute{ivar}.Role=<span class="string">'vector_y'</span>;
6860622     testattr=1;
6870623      <span class="keyword">if</span> test_grid
6880624         VarDimIndex{ivar}=DimIndex;<span class="comment">%permute dimensions</span>
6890625         testperm=1;
6900626     <span class="keyword">end</span>
6910627 <span class="keyword">end</span>
6920628 <span class="keyword">for</span> ivar=VarIndex.A
6930629     <span class="keyword">if</span> test_grid
6940630         VarDimIndex{ivar}=DimIndex;<span class="comment">%permute dimensions</span>
6950631         testperm=1;
6960632     <span class="keyword">end</span>
6970633     <span class="keyword">if</span> isempty(iuA)
6980634         VarAttribute{ivar}.Role=<span class="string">'scalar'</span>;<span class="comment">%Role =scalar</span>
6990635         testattr=1;
7000636     <span class="keyword">else</span>
7010637        VarAttribute=[VarAttribute VarAttribute(ivar)]; <span class="comment">%duplicate the attribute for a new variable</span>
7020638        nbattr=length(VarAttribute);
7030639        VarAttribute{nbattr}.Role=<span class="string">'scalar'</span>;
7040640        testattr=1;
7050641     <span class="keyword">end</span>
7060642 <span class="keyword">end</span>
7070643 <span class="keyword">if</span> testperm
7080644     SubField.VarDimIndex=VarDimIndex(VarIndex_tot);
7090645 <span class="keyword">end</span>
7100646 <span class="keyword">if</span> testattr
7110647     SubField.VarAttribute=VarAttribute(VarIndex_tot);
7120648 <span class="keyword">end</span>
7130649 set(hselect_field,<span class="string">'UserData'</span>,Field)
7140650
7150651 <span class="comment">%---------------------------------------------------------</span>
7160652 <span class="comment">% --- Executes on button press in plot.</span>
7170653 <a name="_sub13" href="#_subfunctions" class="code">function plot_Callback(hObject, eventdata, handles)</a>
7180654 <span class="comment">%---------------------------------------------------------</span>
7190655 list=get(handles.ACTION,<span class="string">'String'</span>);
7200656 index=get(handles.ACTION,<span class="string">'Value'</span>);
7210657 ACTION=list{index};
7220658 hselect_field=get(handles.inputfile,<span class="string">'parent'</span>);<span class="comment">%handle of the get_field interface</span>
7230659 feval(ACTION,hselect_field);
7240660 <a href="#_sub24" class="code" title="subfunction browse_fig(menu_handle)">browse_fig</a>(handles.list_fig); <span class="comment">%update the list of new existing figures</span>
7250661
7260662 <span class="comment">%---------------------------------------------------------</span>
7270663 <span class="comment">% --- Executes on button press in plot.</span>
7280664 <a name="_sub14" href="#_subfunctions" class="code">function PLOT(hget_field)</a>
7290665 <span class="comment">%---------------------------------------------------------</span>
7300666 [SubField,errormsg]=<a href="read_get_field.html" class="code" title="function [SubField,errormsg]=read_get_field(hget_field)">read_get_field</a>(hget_field);
7310667 handles=guidata(hget_field);
7320668 list_fig=get(handles.list_fig,<span class="string">'String'</span>);
7330669 val=get(handles.list_fig,<span class="string">'Value'</span>);
7340670 <span class="keyword">if</span> strcmp(list_fig{val},<span class="string">'uvmat'</span>)
7350671     <a href="uvmat.html" class="code" title="function varargout = uvmat(varargin)">uvmat</a>(SubField)
7360672 <span class="keyword">else</span>
7370673 hfig=str2num(list_fig{val});<span class="comment">% chosen figure number from tyhe GUI</span>
7380674 <span class="keyword">if</span> isempty(hfig)
7390675     hfig=figure;
7400676     list_fig=[list_fig;num2str(hfig)];
7410677     set(handles.list_fig,<span class="string">'String'</span>,list_fig);
7420678     haxes=axes;
7430679 <span class="keyword">else</span>
7440680     figure(hfig);
7450681 <span class="keyword">end</span>
7460682 haxes=findobj(hfig,<span class="string">'Type'</span>,<span class="string">'axes'</span>);
7470683 <a href="plot_field.html" class="code" title="function [PlotType,PlotParamOut,haxes]= plot_field(Data,haxes,PlotParam,KeepLim,PosColorbar)">plot_field</a>(SubField,haxes)
7480684 <span class="keyword">end</span>
7490685
7500686
7510687 <span class="comment">%</span>
7520688 <span class="comment">% return</span>
7530689 <span class="comment">%  testuvmat=0;</span>
7540690 <span class="comment">%     if test_scalar|test_vector</span>
7550691 <span class="comment">%          [DimVarIndex,CellVarIndex,NbDim]=find_field_indices(SubField);</span>
7560692 <span class="comment">%          NbDim=max(NbDim);</span>
7570693 <span class="comment">%          if NbDim==3</span>
7580694 <span class="comment">%            testuvmat=1; %uvmat interface needed for 3D plots</span>
7590695 <span class="comment">%          end</span>
7600696 <span class="comment">%     end</span>
7610697 <span class="comment">%     if iscell(list_fig)</span>
7620698 <span class="comment">%         plot_fig=list_fig{fig_index};</span>
7630699 <span class="comment">%     else</span>
7640700 <span class="comment">%         plot_fig='new fig...';%new plotting axes must be created</span>
7650701 <span class="comment">%     end</span>
7660702 <span class="comment">%     if isequal(plot_fig,'new fig...') &amp;  (test_scalar|test_vector)</span>
7670703 <span class="comment">%         plot_fig='uvmat';%use uvmat for a new fig</span>
7680704 <span class="comment">%     end</span>
7690705 <span class="comment">%     if testuvmat</span>
7700706 <span class="comment">%         plot_fig='uvmat';</span>
7710707 <span class="comment">%     end</span>
7720708 <span class="comment">%     if isequal(plot_fig,'uvmat')</span>
7730709 <span class="comment">%</span>
7740710 <span class="comment">%         huvmat=uvmat(SubField);</span>
7750711 <span class="comment">%         menu=update_menu(handles.list_fig,'uvmat');%add the selected fct to the menu</span>
7760712 <span class="comment">%     else</span>
7770713 <span class="comment">%         test_new=1;</span>
7780714 <span class="comment">%         if ~isequal(plot_fig,'new fig...')</span>
7790715 <span class="comment">%             sep=regexp(plot_fig,'_')%look for subaxes in a fig</span>
7800716 <span class="comment">%             if isempty(sep)</span>
7810717 <span class="comment">%                 axe_index=1;</span>
7820718 <span class="comment">%             else</span>
7830719 <span class="comment">%                 axe_index=str2num(plot_fig(sep+1:end))</span>
7840720 <span class="comment">%                 plot_fig=plot_fig([1:sep-1])</span>
7850721 <span class="comment">%             end</span>
7860722 <span class="comment">%             if ishandle(str2num(plot_fig))</span>
7870723 <span class="comment">%                 haxes=findobj(str2num(plot_fig),'Type','axes')</span>
7880724 <span class="comment">%                 for iaxe=1:length(haxes)</span>
7890725 <span class="comment">%                     Tag=get(haxes(iaxe),'Tag');</span>
7900726 <span class="comment">%                     if isequal(Tag,'Colorbar')|isequal(Tag,'legend')</span>
7910727 <span class="comment">%                        iselect(iaxe)=0;</span>
7920728 <span class="comment">%                     else</span>
7930729 <span class="comment">%                        iselect(iaxe)=1;</span>
7940730 <span class="comment">%                     end</span>
7950731 <span class="comment">%                 end</span>
7960732 <span class="comment">%                 haxes=haxes(find(iselect));</span>
7970733 <span class="comment">%                 if length(haxes)&gt;=axe_index</span>
7980734 <span class="comment">%                     test_new=0</span>
7990735 <span class="comment">%                     haxes=haxes(axe_index);</span>
8000736 <span class="comment">%                     set(haxes,'NextPlot','add')</span>
8010737 <span class="comment">%                 end</span>
8020738 <span class="comment">%             end</span>
8030739 <span class="comment">%         end</span>
8040740 <span class="comment">%         if test_new</span>
8050741 <span class="comment">%             hfig=figure;</span>
8060742 <span class="comment">%             haxes=axes;</span>
8070743 <span class="comment">%             menu=update_menu(handles.list_fig,num2str(hfig));%add the selected fct to the menu</span>
8080744 <span class="comment">%         end</span>
8090745 <span class="comment">%         plot_field(SubField,haxes)</span>
8100746 <span class="comment">%     end</span>
8110747 <span class="comment">% end</span>
8120748 <span class="comment">%</span>
8130749 <span class="comment">%</span>
8140750 <span class="comment">%</span>
8150751 <span class="comment">%</span>
8160752 <span class="comment">%  w components</span>
8170753 <span class="comment">% end</span>
8180754 <span class="comment">%</span>
8190755 <span class="comment">%</span>
8200756 <span class="comment">% % select the variable  index (or indices) for z coordinates</span>
8210757 <span class="comment">% test_grid=0;</span>
8220758 <span class="comment">% if test_scalar | test_vector</span>
8230759 <span class="comment">%     nbdim=length(DimIndex);</span>
8240760 <span class="comment">%     if nbdim &gt; 3</span>
8250761 <span class="comment">%         warndlg_uvmat('array with more than three dimensions, not supported','ERROR')</span>
8260762 <span class="comment">%         return</span>
8270763 <span class="comment">%     else</span>
8280764 <span class="comment">%         perm_ind=[1:nbdim];</span>
8290765 <span class="comment">%     end</span>
8300766 <span class="comment">%     if nbdim==3</span>
8310767 <span class="comment">%         zstring=get(handles.coord_z_vectors_scalar,'String');</span>
8320768 <span class="comment">%         zindex=get(handles.coord_z_vectors_scalar,'Value'); %selected indices in the ordinate listbox</span>
8330769 <span class="comment">%         list_var=zstring(zindex);</span>
8340770 <span class="comment">%         VarIndex_z=name2index(list_var,Field.ListVarName);%index of the selected variable</span>
8350771 <span class="comment">%         if isequal(VarIndex.A,VarIndex_z)|isequal(VarIndex.u,VarIndex_z)|isequal(VarIndex.v,VarIndex_z)|isequal(VarIndex.w,VarIndex_z)</span>
8360772 <span class="comment">%             if zindex ~= 1</span>
8370773 <span class="comment">%                 set(handles.coord_z_vectors_scalar,'Value',1)%ordinate cannot be the same as scalar or vector components</span>
8380774 <span class="comment">%                 return</span>
8390775 <span class="comment">%             end</span>
8400776 <span class="comment">%         else</span>
8410777 <span class="comment">%             VarIndex_tot=[VarIndex_tot VarIndex_z];</span>
8420778 <span class="comment">%             DimIndex_z=Field.VarDimIndex{VarIndex_z};</span>
8430779 <span class="comment">%             DimValue=Field.DimValue(DimIndex_z);</span>
8440780 <span class="comment">%             ind=find(DimValue==1);</span>
8450781 <span class="comment">%             DimIndex_z(ind)=[];%Mremove singleton</span>
8460782 <span class="comment">%             if isequal(DimIndex_z,DimIndex)</span>
8470783 <span class="comment">%                 VarAttribute{VarIndex_z}.Role='coord_z';%unstructured coordinates</span>
8480784 <span class="comment">%             elseif length(DimIndex_z)==1</span>
8490785 <span class="comment">%                 VarAttribute{VarIndex_z}.Role=Field.ListDimName{DimIndex_z};  %dimension variable</span>
8500786 <span class="comment">%                 ind_z=find(DimIndex==DimIndex_z(1));</span>
8510787 <span class="comment">%                 perm_ind(ind_z)=1;</span>
8520788 <span class="comment">%                 test_grid=1;</span>
8530789 <span class="comment">%             else</span>
8540790 <span class="comment">%                 warndlg_uvmat('multiple dimensions for the z coordinate','ERROR')</span>
8550791 <span class="comment">%                 return</span>
8560792 <span class="comment">%             end</span>
8570793 <span class="comment">%         end</span>
8580794 <span class="comment">% %         if ~isempty(VarIndex_z)</span>
8590795 <span class="comment">% %             DimIndex_z=Field.VarDimIndex{VarIndex_z};%dimension indices of the variable</span>
8600796 <span class="comment">% %             if length(DimIndex_z)==1 &amp; nbdim==3 %dimension variable</span>
8610797 <span class="comment">% %                 VarAttribute{VarIndex_z}.Role=Field.ListDimName{DimIndex_z};</span>
8620798 <span class="comment">% %                 ind_z=find(DimIndex==DimIndex_z(1));</span>
8630799 <span class="comment">% %                 perm_ind(ind_z)=1;</span>
8640800 <span class="comment">% %                 test_grid=1;</span>
8650801 <span class="comment">% %             end</span>
8660802 <span class="comment">% %         end</span>
8670803 <span class="comment">%     end</span>
8680804 <span class="comment">% end</span>
8690805 <span class="comment">%</span>
8700806 <span class="comment">% % select the variable  index (or indices) for ordinate</span>
8710807 <span class="comment">% ystring=get(handles.ordinate,'String');</span>
8720808 <span class="comment">% yindex=get(handles.ordinate,'Value'); %selected indices in the ordinate listbox</span>
8730809 <span class="comment">% list_var=ystring(yindex);</span>
8740810 <span class="comment">% VarIndex.y=name2index(list_var,Field.ListVarName);</span>
8750811 <span class="comment">% if isequal(VarIndex.A,VarIndex.y)|isequal(VarIndex.u,VarIndex.y)|isequal(VarIndex.v,VarIndex.y)|isequal(VarIndex.w,VarIndex.y)</span>
8760812 <span class="comment">%    set(handles.ordinate,'Value',1)%ordinate cannot be the same as scalar or vector components</span>
8770813 <span class="comment">% else</span>
8780814 <span class="comment">%     for ivar=1:length(VarIndex.y)</span>
8790815 <span class="comment">%         VarAttribute{VarIndex.y(ivar)}.Role='coord_y';</span>
8800816 <span class="comment">%     end</span>
8810817 <span class="comment">%     VarIndex_tot=[VarIndex_tot VarIndex.y];</span>
8820818 <span class="comment">% end</span>
8830819 <span class="comment">% if (test_scalar | test_vector) &amp;  ~isempty(VarIndex.y)</span>
8840820 <span class="comment">%     DimIndex_y=Field.VarDimIndex{VarIndex.y};%dimension indices of the variable</span>
8850821 <span class="comment">%     if length(DimIndex_y)==1</span>
8860822 <span class="comment">%         ind_y=find(DimIndex==DimIndex_y(1));</span>
8870823 <span class="comment">%         test_grid=1;</span>
8880824 <span class="comment">%         if nbdim==3</span>
8890825 <span class="comment">%             VarAttribute{VarIndex.y}.Role=Field.ListDimName{DimIndex_y};</span>
8900826 <span class="comment">%             perm_ind(ind_y)=2;</span>
8910827 <span class="comment">%         elseif nbdim==2</span>
8920828 <span class="comment">%             VarAttribute{VarIndex.y}.Role=Field.ListDimName{DimIndex_y};</span>
8930829 <span class="comment">%              perm_ind(ind_y)=1;</span>
8940830 <span class="comment">%         end</span>
8950831 <span class="comment">%     elseif test_grid</span>
8960832 <span class="comment">%         warndlg_uvmat('the dimension of the y coordinate variable should be 1','ERROR')</span>
8970833 <span class="comment">%     end</span>
8980834 <span class="comment">% end</span>
8990835 <span class="comment">%</span>
9000836 <span class="comment">% %select the variable index for the abscissa</span>
9010837 <span class="comment">% xstring=get(handles.abscissa,'String');</span>
9020838 <span class="comment">% xindex=get(handles.abscissa,'Value');</span>
9030839 <span class="comment">% list_var=xstring(xindex);</span>
9040840 <span class="comment">% VarIndex.x=name2index(list_var,Field.ListVarName);%var index corresponding to var name list_var</span>
9050841 <span class="comment">% if length(VarIndex.x)==1</span>
9060842 <span class="comment">%     DimIndex_x=Field.VarDimIndex{VarIndex.x};</span>
9070843 <span class="comment">%     DimValue=Field.DimValue(DimIndex_x);</span>
9080844 <span class="comment">%     ind=find(DimValue==1);</span>
9090845 <span class="comment">%     DimIndex_x(ind)=[];%Mremove singleton</span>
9100846 <span class="comment">%     VarAttribute{VarIndex.x}.Role=Field.ListDimName{DimIndex_x};  %dimension variable</span>
9110847 <span class="comment">% %     VarAttribute{VarIndex.x}.Role='coord_x';%default (may be modified)</span>
9120848 <span class="comment">%     index_detect=find(VarIndex_tot==VarIndex.x);</span>
9130849 <span class="comment">% else</span>
9140850 <span class="comment">%     index_detect=[];%coord x variable not already used</span>
9150851 <span class="comment">% end</span>
9160852 <span class="comment">% if isempty(index_detect)</span>
9170853 <span class="comment">%     VarIndex_tot=[VarIndex_tot VarIndex.x];</span>
9180854 <span class="comment">% else</span>
9190855 <span class="comment">%     VarIndex.x=[];</span>
9200856 <span class="comment">%     set(handles.abscissa,'Value',1)%vchosen abscissa already chosen, suppres it as abscissa</span>
9210857 <span class="comment">% end</span>
9220858 <span class="comment">%</span>
9230859 <span class="comment">% if (test_scalar | test_vector) &amp;  ~isempty(VarIndex.x)</span>
9240860 <span class="comment">%     DimIndex_x=Field.VarDimIndex{VarIndex.x};%dimension indices of the variable</span>
9250861 <span class="comment">%     if length(DimIndex_x)==1</span>
9260862 <span class="comment">%         ind_x=find(DimIndex==DimIndex_x(1));</span>
9270863 <span class="comment">%         if nbdim==3</span>
9280864 <span class="comment">%             %VarAttribute{VarIndex.x}.Role=Field.ListDimName{DimIndex_x};</span>
9290865 <span class="comment">%             perm_ind(ind_x)=3;</span>
9300866 <span class="comment">%         elseif nbdim==2</span>
9310867 <span class="comment">%             %VarAttribute{VarIndex.x}.Role=Field.ListDimName{DimIndex_x};</span>
9320868 <span class="comment">%              perm_ind(ind_x)=2;</span>
9330869 <span class="comment">%         end</span>
9340870 <span class="comment">%         if isequal(perm_ind,[1:nbdim])</span>
9350871 <span class="comment">%             test_grid=0;</span>
9360872 <span class="comment">%         end</span>
9370873 <span class="comment">%         DimIndex=DimIndex(perm_ind);</span>
9380874 <span class="comment">%     elseif test_grid</span>
9390875 <span class="comment">%         warndlg_uvmat('the dimension of the x coordinate variable should be 1','ERROR')</span>
9400876 <span class="comment">%     end</span>
9410877 <span class="comment">%     if isequal(DimIndex_x,DimIndex)</span>
9420878 <span class="comment">%                 VarAttribute{VarIndex.x}.Role='coord_x';%unstructured coordinates</span>
9430879 <span class="comment">%     end</span>
9440880 <span class="comment">% end</span>
9450881 <span class="comment">%</span>
9460882 <span class="comment">% %defined the selected sub-field SubField</span>
9470883 <span class="comment">% SubField.ListGlobalAttribute{1}='InputFile';</span>
9480884 <span class="comment">% SubField.InputFile=get(handles.inputfile,'String');</span>
9490885 <span class="comment">% SubField.ListVarName=Field.ListVarName(VarIndex_tot);</span>
9500886 <span class="comment">% VarDimIndex=Field.VarDimIndex;</span>
9510887 <span class="comment">%</span>
9520888 <span class="comment">% for ivar=VarIndex.u</span>
9530889 <span class="comment">%     VarAttribute{ivar}.Role='vector_x';</span>
9540890 <span class="comment">%     if test_grid</span>
9550891 <span class="comment">%         VarDimIndex{ivar}=DimIndex; %permute dimensions</span>
9560892 <span class="comment">%     end</span>
9570893 <span class="comment">% end</span>
9580894 <span class="comment">% for ivar=VarIndex.v</span>
9590895 <span class="comment">%     VarAttribute{ivar}.Role='vector_y';</span>
9600896 <span class="comment">%      if test_grid</span>
9610897 <span class="comment">%         VarDimIndex{ivar}=DimIndex;%permute dimensions</span>
9620898 <span class="comment">%     end</span>
9630899 <span class="comment">% end</span>
9640900 <span class="comment">% for ivar=VarIndex.A</span>
9650901 <span class="comment">%     if test_grid</span>
9660902 <span class="comment">%         VarDimIndex{ivar}=DimIndex;%permute dimensions</span>
9670903 <span class="comment">%     end</span>
9680904 <span class="comment">%     if isempty(iuA)</span>
9690905 <span class="comment">%         VarAttribute{ivar}.Role='scalar';%Role =scalar</span>
9700906 <span class="comment">%     else</span>
9710907 <span class="comment">%        VarAttribute=[VarAttribute VarAttribute{ivar}]; %duplicate the attribute for a new variable</span>
9720908 <span class="comment">%        nbattr=length(VarAttribute);</span>
9730909 <span class="comment">%        VarAttribute{nbattr}.Role='scalar';</span>
9740910 <span class="comment">%     end</span>
9750911 <span class="comment">% end</span>
9760912 <span class="comment">% SubField.VarDimIndex=VarDimIndex(VarIndex_tot);</span>
9770913 <span class="comment">% SubField.VarAttribute=VarAttribute(VarIndex_tot);</span>
9780914 <span class="comment">% % Field.SubListVarName=SubField.ListVarName;</span>
9790915 <span class="comment">% % Field.SubVarDimIndex=SubField.VarDimIndex;</span>
9800916 <span class="comment">% % Field.SubVarAttribute=SubField.VarAttribute;</span>
9810917 <span class="comment">% set(hselect_field,'UserData',Field);</span>
9820918 <span class="comment">% % copy variables on SubField</span>
9830919 <span class="comment">% for ivar=1:length(VarIndex_tot)</span>
9840920 <span class="comment">%     VarName=Field.ListVarName{VarIndex_tot(ivar)};</span>
9850921 <span class="comment">%     eval(['SubField.' VarName '=Field.' VarName ';'])</span>
9860922 <span class="comment">% end</span>
9870923 <span class="comment">% if test_grid</span>
9880924 <span class="comment">%     for ivar=1:length(VarIndex.u)</span>
9890925 <span class="comment">%          VarName=Field.ListVarName{VarIndex.u(ivar)};</span>
9900926 <span class="comment">%         eval(['SubField.' VarName '=permute(SubField.' VarName ',perm_ind);'])</span>
9910927 <span class="comment">%     end</span>
9920928 <span class="comment">%</span>
9930929 <span class="comment">%     for ivar=1:length(VarIndex.v)</span>
9940930 <span class="comment">%          VarName=Field.ListVarName{VarIndex.v(ivar)};</span>
9950931 <span class="comment">%         eval(['SubField.' VarName '=permute(SubField.' VarName ',perm_ind);'])</span>
9960932 <span class="comment">%     end</span>
9970933 <span class="comment">%     for ivar=1:length(VarIndex.A)</span>
9980934 <span class="comment">%          VarName=Field.ListVarName{VarIndex.A(ivar)};</span>
9990935 <span class="comment">%         eval(['SubField.' VarName '=permute(SubField.' VarName ',perm_ind);'])</span>
10000936 <span class="comment">%     end</span>
10010937 <span class="comment">% end</span>
10020938 <span class="comment">% if ~isempty(iuA)</span>
10030939 <span class="comment">%     VarName= ['A' Field.ListVarName{iuA}]; %create the new variable to distinguish the scaler form the velocity component</span>
10040940 <span class="comment">%     SubField.ListVarName=[SubField.ListVarName VarName];</span>
10050941 <span class="comment">%     SubField.VarDimIndex=[SubField.VarDimIndex Field.VarDimIndex(iuA)];</span>
10060942 <span class="comment">%     eval(['SubField.' VarName '=Field.'  Field.ListVarName{iuA} ';'])</span>
10070943 <span class="comment">% end</span>
10080944 <span class="comment">% % dimension of SubField</span>
10090945 <span class="comment">% if test_scalar|test_vector</span>
10100946 <span class="comment">%    % SubField.NbDim=2;</span>
10110947 <span class="comment">%     SubField.InputFile=get(handles.inputfile,'String');</span>
10120948 <span class="comment">%     SubField.get_field_handle=hselect_field;</span>
10130949 <span class="comment">% else</span>
10140950 <span class="comment">%     SubField.NbDim=1;</span>
10150951 <span class="comment">% end</span>
10160952 <span class="comment">%</span>
10170953 <span class="comment">% list_fig=get(handles.list_fig,'String');</span>
10180954 <span class="comment">% fig_index=get(handles.list_fig,'Value');</span>
10190955 <span class="comment">% %ACTION on SubField</span>
10200956 <span class="comment">% index=get(handles.ACTION,'Value');</span>
10210957
10220958 <span class="comment">%</span>
10230959 <span class="comment">% %     if (test_scalar|test_vector)</span>
10240960 <span class="comment">% %         plot_fig='uvmat';</span>
10250961 <span class="comment">% %     elseif iscell(list_fig)</span>
10260962 <span class="comment">%     testuvmat=0;</span>
10270963 <span class="comment">%     if test_scalar|test_vector</span>
10280964 <span class="comment">%          [DimVarIndex,CellVarIndex,NbDim]=find_field_indices(SubField);</span>
10290965 <span class="comment">%          NbDim=max(NbDim);</span>
10300966 <span class="comment">%          if NbDim==3</span>
10310967 <span class="comment">%            testuvmat=1; %uvmat interface needed for 3D plots</span>
10320968 <span class="comment">%          end</span>
10330969 <span class="comment">%     end</span>
10340970 <span class="comment">%     if iscell(list_fig)</span>
10350971 <span class="comment">%         plot_fig=list_fig{fig_index};</span>
10360972 <span class="comment">%     else</span>
10370973 <span class="comment">%         plot_fig='new fig...';%new plotting axes must be created</span>
10380974 <span class="comment">%     end</span>
10390975 <span class="comment">%     if isequal(plot_fig,'new fig...') &amp;  (test_scalar|test_vector)</span>
10400976 <span class="comment">%         plot_fig='uvmat';%use uvmat for a new fig</span>
10410977 <span class="comment">%     end</span>
10420978 <span class="comment">%     if testuvmat</span>
10430979 <span class="comment">%         plot_fig='uvmat';</span>
10440980 <span class="comment">%     end</span>
10450981 <span class="comment">%     if isequal(plot_fig,'uvmat')</span>
10460982 <span class="comment">%</span>
10470983 <span class="comment">%         huvmat=uvmat(SubField);</span>
10480984 <span class="comment">%         menu=update_menu(handles.list_fig,'uvmat');%add the selected fct to the menu</span>
10490985 <span class="comment">%     else</span>
10500986 <span class="comment">%         test_new=1;</span>
10510987 <span class="comment">%         if ~isequal(plot_fig,'new fig...')</span>
10520988 <span class="comment">%             sep=regexp(plot_fig,'_')%look for subaxes in a fig</span>
10530989 <span class="comment">%             if isempty(sep)</span>
10540990 <span class="comment">%                 axe_index=1;</span>
10550991 <span class="comment">%             else</span>
10560992 <span class="comment">%                 axe_index=str2num(plot_fig(sep+1:end))</span>
10570993 <span class="comment">%                 plot_fig=plot_fig([1:sep-1])</span>
10580994 <span class="comment">%             end</span>
10590995 <span class="comment">%             if ishandle(str2num(plot_fig))</span>
10600996 <span class="comment">%                 haxes=findobj(str2num(plot_fig),'Type','axes')</span>
10610997 <span class="comment">%                 for iaxe=1:length(haxes)</span>
10620998 <span class="comment">%                     Tag=get(haxes(iaxe),'Tag');</span>
10630999 <span class="comment">%                     if isequal(Tag,'Colorbar')|isequal(Tag,'legend')</span>
10641000 <span class="comment">%                        iselect(iaxe)=0;</span>
10651001 <span class="comment">%                     else</span>
10661002 <span class="comment">%                        iselect(iaxe)=1;</span>
10671003 <span class="comment">%                     end</span>
10681004 <span class="comment">%                 end</span>
10691005 <span class="comment">%                 haxes=haxes(find(iselect));</span>
10701006 <span class="comment">%                 if length(haxes)&gt;=axe_index</span>
10711007 <span class="comment">%                     test_new=0</span>
10721008 <span class="comment">%                     haxes=haxes(axe_index);</span>
10731009 <span class="comment">%                     set(haxes,'NextPlot','add')</span>
10741010 <span class="comment">%                 end</span>
10751011 <span class="comment">%             end</span>
10761012 <span class="comment">%         end</span>
10771013 <span class="comment">%         if test_new</span>
10781014 <span class="comment">%             hfig=figure;</span>
10791015 <span class="comment">%             haxes=axes;</span>
10801016 <span class="comment">%             menu=update_menu(handles.list_fig,num2str(hfig));%add the selected fct to the menu</span>
10811017 <span class="comment">%         end</span>
10821018 <span class="comment">%         plot_field(SubField,haxes)</span>
10831019 <span class="comment">%     end</span>
10841020 <span class="comment">% end</span>
10851021 <span class="comment">% %Field.VarIndex=VarIndex; %save for use in uvmat</span>
10861022 <span class="comment">% % set(hselect_field,'UserData',Field)</span>
10871023
10881024
10891025 <span class="comment">%------------------------------------------------</span>
10901026 <span class="comment">% --- Executes on button press in Plot_histo.</span>
10911027 <span class="comment">%plot global histograms</span>
10921028 <span class="comment">%-------------------------------------------------</span>
10931029 <a name="_sub15" href="#_subfunctions" class="code">function plot_histo_Callback(hObject, eventdata, handles)</a>
10941030 <span class="comment">% hObject    handle to plot (see GCBO)</span>
10951031 <span class="comment">% eventdata  reserved - to be defined in a future version of MATLAB</span>
10961032 <span class="comment">% handles    structure with handles and user data (see GUIDATA)</span>
10971033
10981034 <span class="comment">%time plots</span>
10991035 leg={};
11001036 n=0;
11011037 <span class="keyword">if</span> (get(handles.cm_switch,<span class="string">'Value'</span>)==1)
11021038     Uval_p=Uval_cm;
11031039     Vval_p=Vval_cm;
11041040     Uhist_p=Uhist_cm;
11051041     Vhist_p=Vhist_cm;
11061042     xlab=<span class="string">'velocity (cm/s)'</span>;
11071043 <span class="keyword">else</span>
11081044     Uval_p=Uval;
11091045     Vval_p=Vval;
11101046     Uhist_p=Uhist;
11111047     Vhist_p=Vhist;
11121048     xlab=<span class="string">'velocity (pixels)'</span>;
11131049 <span class="keyword">end</span>
11141050 <span class="keyword">if</span> (get(handles.vector_y,<span class="string">'Value'</span>) == 1)
11151051    hhh=figure(2);
11161052    hold on
11171053    title([filebase <span class="string">', '</span> strindex <span class="string">', '</span> fieldtitle])
11181054    plot(Uval_p,Uhist_p,<span class="string">'b-'</span>)
11191055    n=n+1;
11201056    leg{n}=<span class="string">'Uhist'</span>;
11211057    xlabel(xlab)
11221058 <span class="keyword">end</span>
11231059 <span class="keyword">if</span> (get(handles.Vhist_input,<span class="string">'Value'</span>) == 1)
11241060    hhh=figure(2);
11251061    hold on
11261062    title([filebase <span class="string">', '</span> strindex <span class="string">', '</span> fieldtitle])
11271063    plot(Vval_p,Vhist_p,<span class="string">'r-'</span>)
11281064    n=n+1;
11291065    leg{n}=<span class="string">'Vhist'</span>;
11301066    xlabel(xlab);
11311067 <span class="keyword">end</span>
11321068 <span class="keyword">if</span> (get(handles.Chist_input,<span class="string">'Value'</span>) == 1)
11331069    hhhh=figure(3);
11341070    hold on
11351071    title([filebase <span class="string">', '</span> strindex <span class="string">', '</span> fieldtitle])
11361072    plot(Cval,Chist,<span class="string">'k-'</span>)
11371073    leg{1}=<span class="string">'Chist'</span>;
11381074 <span class="keyword">end</span>
11391075 <span class="comment">% hold off</span>
11401076 grid on
11411077 legend(leg);
11421078
11431079 <span class="comment">% %-------------------------------------------------------------</span>
11441080 <span class="comment">% % --- Executes on button press in Save_input.</span>
11451081 <span class="comment">% function Save_input_Callback(hObject, eventdata, handles)</span>
11461082 <span class="comment">% list_str=get(handles.abscissa,'String');</span>
11471083 <span class="comment">% val=get(handles.abscissa,'Value');</span>
11481084 <span class="comment">% var=list_str{val};</span>
11491085 <span class="comment">% hselect_field=get(handles.Save_input,'parent')</span>
11501086 <span class="comment">% set(hselect_field,'UserData',var);</span>
11511087 <span class="comment">% set(hselect_field,'Tag','idle')</span>
11521088
11531089 <span class="comment">%</span>
11541090 <span class="comment">% %-------------------------------------------------------------</span>
11551091 <span class="comment">% % --- Executes on button press in save_histo.</span>
11561092 <span class="comment">% function save_histo_Callback(hObject, eventdata, handles)</span>
11571093 <span class="comment">% global filebase</span>
11581094 <span class="comment">%</span>
11591095 <span class="comment">% pathstr = fileparts(filebase)</span>
11601096 <span class="comment">% if (get(handles.Chist_input,'Value') == 1)</span>
11611097 <span class="comment">%     def = {[pathstr pathstr(1) 'PIV_corr_histo.fig']};</span>
11621098 <span class="comment">%     else</span>
11631099
11641100 <span class="comment">%     def = {[pathstr pathstr(1) 'vel_histo.fig']};</span>
11651101 <span class="comment">% end</span>
11661102 <span class="comment">% prompt={'save figure(2) as'}</span>
11671103 <span class="comment">% dlg_title = 'save figure';</span>
11681104 <span class="comment">% num_lines= 1;</span>
11691105 <span class="comment">% answer = inputdlg(prompt,dlg_title,num_lines,def)</span>
11701106 <span class="comment">% saveas(2,answer{1})</span>
11711107 
11721108 <span class="comment">%</span>
11731109 <span class="comment">% % --- Executes on selection change in spectrum.</span>
11741110 <span class="comment">% function Field=FFT(Field)</span>
11751111 <span class="comment">% 'TESTFFT'</span>
11761112 <span class="comment">% Field</span>
11771113 <span class="comment">% nbfield=length(Field.ListVarName);</span>
11781114 <span class="comment">% if nbfield==0</span>
11791115 <span class="comment">%     warndlg_uvmat('no field selected for FFT','ERROR')</span>
11801116 <span class="comment">% elseif nbfield&gt;2</span>
11811117 <span class="comment">%     warndlg_uvmat('select only one field for FFT','ERROR')</span>
11821118 <span class="comment">% end</span>
11831119 <span class="comment">% if nbfield==2</span>
11841120 <span class="comment">% % list_fields=get(handles.spectrum,'String');% list menu fields</span>
11851121 <span class="comment">% % index_fields=get(handles.spectrum,'Value');% selected string index</span>
11861122 <span class="comment">% % fields= list_fields{index_fields(1)}; % selected action</span>
11871123 <span class="comment">% % func=eval(fields);</span>
11881124 <span class="comment">%     dtmin=min(diff(time));%time step</span>
11891125 <span class="comment">%     time1=time(1);timend=time(end);</span>
11901126 <span class="comment">%     timeq=[time1:dtmin:timend];%equal time spacing</span>
11911127 <span class="comment">%     funcinterp=interp1(time,func,timeq); %interpolated func</span>
11921128 <span class="comment">% else</span>
11931129 <span class="comment">%     varname=Field.ListVarName{1};</span>
11941130 <span class="comment">%     eval(['funcinterp=Field.' varname ';'])</span>
11951131 <span class="comment">% end</span>
11961132 <span class="comment">% np=length(funcinterp);</span>
11971133 <span class="comment">% funcinterp=funcinterp-sum(funcinterp)/np; %substract mean</span>
11981134 <span class="comment">% fourier=fft(funcinterp);%take fft (complex)</span>
11991135 <span class="comment">% spec=abs(fourier).*abs(fourier);% take sqare of the modulus</span>
12001136 <span class="comment">% spec=spec([1:floor(np/2)]);%keep only the first half (the other is symmetric)</span>
12011137 <span class="comment">% eval(['Field.' varname '=spec;'])</span>
12021138 <span class="comment">% Field</span>
12031139 <span class="comment">% % dfreq=1/(time(end)-time(1));%frequency interval</span>
12041140 <span class="comment">% % freq=[0:dfreq:(floor(np/2)-1)*dfreq];</span>
12051141 <span class="comment">% % figure(1)</span>
12061142 <span class="comment">% % hold on</span>
12071143 <span class="comment">% % plot(freq,spec)</span>
12081144 <span class="comment">% % xlabel('frequency (Hz)')</span>
12091145 <span class="comment">% % ylabel('spectral intensity')</span>
12101146 <span class="comment">% % title(['spectrum of' fields]);</span>
12111147 <span class="comment">% % grid on</span>
12121148
12131149
12141150
12151151
12161152
12171153 <span class="comment">%%-------------------------------------------------------</span>
12181154 <span class="comment">% --- Executes on button press in peaklocking.</span>
12191155 <span class="comment">%-------------------------------------------------</span>
12201156 <a name="_sub16" href="#_subfunctions" class="code">function peaklocking(handles)</a>
12211157 <span class="comment">%evaluation of peacklocking errors</span>
12221158 <span class="comment">%use splinhist: give spline coeff cc for a smooth histo (call spline4)</span>
12231159 <span class="comment">%use histsmooth(x,cc): calculate the smooth histo for any value x</span>
12241160 <span class="comment">%use histder(x,cc): calculate the derivative of the smooth histo</span>
12251161 <span class="keyword">global</span> hfig1 hfig2 hfig3
12261162 <span class="keyword">global</span> nbb Uval Vval Uhist Vhist <span class="comment">% nbb resolution of the histogram nbb=10: 10 values in unity interval</span>
12271163 <span class="keyword">global</span> xval xerror yval yerror
12281164
12291165 set(handles.vector_y,<span class="string">'Value'</span>,1)<span class="comment">% trigger the option Uhist on the interface</span>
12301166 set(handles.Vhist_input,<span class="string">'Value'</span>,1)
12311167 set(handles.cm_switch,<span class="string">'Value'</span>,0) <span class="comment">% put the switch to 'pixel'</span>
12321168
12331169 <span class="comment">%adjust the extremal values of the histogram in U with respect to integer</span>
12341170 <span class="comment">%values</span>
12351171 minimU=round(min(Uval)-0.5)+0.5; <span class="comment">%first value of the histogram with integer bins</span>
12361172 maximU=round(max(Uval)-0.5)+0.5;
12371173 minim_fin=(minimU-0.5+1/(2*nbb)); <span class="comment">% first bin valueat the beginning of an integer interval</span>
12381174 maxim_fin=(maximU+0.5-1/(2*nbb)); <span class="comment">% last integer value</span>
12391175 nb_bin_min= round(-(minim_fin - min(Uval))*nbb); <span class="comment">% nbre of bins added below</span>
12401176 nb_bin_max=round((maxim_fin -max(Uval))*nbb); <span class="comment">%nbre of bins added above</span>
12411177 Uval=[minim_fin:(1/nbb):maxim_fin];
12421178 histu_min=zeros(nb_bin_min,1);
12431179 histu_max=zeros(nb_bin_max,1);
12441180 Uhist=[histu_min; Uhist ;histu_max]; <span class="comment">% column vector</span>
12451181
12461182 <span class="comment">%adjust the extremal values of the histogram in V</span>
12471183 minimV=round(min(Vval-0.5)+0.5);
12481184 maximV=round(max(Vval-0.5)+0.5);
12491185 minim_fin=minimV-0.5+1/(2*nbb); <span class="comment">% first bin valueat the beginning of an integer interval</span>
12501186 maxim_fin=maximV+0.5-1/(2*nbb); <span class="comment">% last integer value</span>
12511187 nb_bin_min=round((min(Vval) - minim_fin)*nbb); <span class="comment">% nbre of bins added below</span>
12521188 nb_bin_max=round((maxim_fin -max(Vval))*nbb);
12531189 Vval=[minim_fin:(1/nbb):maxim_fin];
12541190 histu_min=zeros(nb_bin_min,1);
12551191 histu_max=zeros(nb_bin_max,1);
12561192 Vhist=[histu_min; Vhist ;histu_max]; <span class="comment">% column vector</span>
12571193
12581194 <span class="comment">% plot_histo_Callback(hObject, eventdata, handles)</span>
12591195 <span class="comment">% %adjust the histogram to integer values:</span>
12601196
12611197 <span class="comment">%histoU and V</span>
12621198 [Uhistinter,xval,xerror]=<a href="peaklock.html" class="code" title="function [histinter,x,error]=peaklock(nbb,minim,maxim,histu)">peaklock</a>(nbb,minimU,maximU,Uhist);
12631199 [Vhistinter,yval,yerror]=<a href="peaklock.html" class="code" title="function [histinter,x,error]=peaklock(nbb,minim,maxim,histu)">peaklock</a>(nbb,minimV,maximV,Vhist);
12641200
12651201 <span class="comment">% selection of value ranges such that histo&gt;=10 (enough statistics)</span>
12661202 Uval_ind=find(Uhist&gt;=10);
12671203 ind_min=min(Uval_ind);
12681204 ind_max=max(Uval_ind);
12691205 U_min=Uval(ind_min);<span class="comment">% minimum allowed value</span>
12701206 U_max=Uval(ind_max);<span class="comment">%maximum allowed value</span>
12711207
12721208 <span class="comment">% selection of value ranges such that histo&gt;=10 (enough statistics)</span>
12731209 Vval_ind=find(Vhist&gt;=10);
12741210 ind_min=min(Vval_ind);
12751211 ind_max=max(Vval_ind);
12761212 V_min=Vval(ind_min);<span class="comment">% minimum allowed value</span>
12771213 V_max=Vval(ind_max);<span class="comment">%maximum allowed value</span>
12781214
12791215 figure(4)<span class="comment">% plot U histogram with smoothed one</span>
12801216 plot(Uval,Uhist,<span class="string">'b'</span>)
12811217 grid on
12821218 hold on
12831219 plot(Uval,Uhistinter,<span class="string">'r'</span>);
12841220 hold off
12851221
12861222 figure(5)<span class="comment">% plot V histogram with smoothed one</span>
12871223 plot(Vval,Vhist,<span class="string">'b'</span>)
12881224 grid on
12891225 hold on
12901226 plot(Vval,Vhistinter,<span class="string">'r'</span>);
12911227 hold off
12921228
12931229 figure(6)<span class="comment">% plot pixel error in two subplots</span>
12941230 hfig4=subplot(2,1,1);
12951231 hfig5=subplot(2,1,2);
12961232 axes(hfig4)
12971233 plot(xval,xerror)
12981234 axis([U_min U_max -0.4 0.4])
12991235 xlabel(<span class="string">'velocity u (pix)'</span>)
13001236 ylabel(<span class="string">'peaklocking error (pix)'</span>)
13011237 grid on
13021238 axes(hfig5)
13031239 plot(yval,yerror)
13041240 axis([V_min V_max -0.4 0.4]);
13051241 xlabel(<span class="string">'velocity v (pix)'</span>)
13061242 ylabel(<span class="string">'peaklocking error (pix)'</span>)
13071243 grid on
13081244
13091245
13101246 <span class="comment">% ------------------------------------------------------------------</span>
13111247 <a name="_sub17" href="#_subfunctions" class="code">function variables_Callback(hObject, eventdata, handles)</a>
13121248 Tabchar={<span class="string">''</span>};<span class="comment">%default</span>
13131249 Tabcell=[];
13141250 hselect_field=get(handles.variables,<span class="string">'parent'</span>);
13151251 Field=get(hselect_field,<span class="string">'UserData'</span>);
13161252 index=get(handles.variables,<span class="string">'Value'</span>);<span class="comment">%index in the list 'variables'</span>
13171253 <span class="keyword">if</span> isequal(index,1)
13181254     set(handles.attributes_txt,<span class="string">'String'</span>,<span class="string">'global attributes'</span>)
13191255 <span class="comment">% list global attribute names and values if index=1 (blank variable display) is selected</span>
13201256     <span class="keyword">if</span> isfield(Field,<span class="string">'ListGlobalAttribute'</span>) &amp;&amp; ~isempty(Field.ListGlobalAttribute)
13211257         <span class="keyword">for</span> iline=1:length(Field.ListGlobalAttribute)
13221258             Tabcell{iline,1}=Field.ListGlobalAttribute{iline};   
13231259             <span class="keyword">if</span> isfield(Field, Field.ListGlobalAttribute{iline})
13241260                 eval([<span class="string">'val=Field.'</span> Field.ListGlobalAttribute{iline} <span class="string">';'</span>])
13251261                 <span class="keyword">if</span> ischar(val);
13261262                     Tabcell{iline,2}=val;
13271263                 <span class="keyword">else</span>
13281264                     Tabcell{iline,2}=num2str(val);
13291265                 <span class="keyword">end</span>
13301266             <span class="keyword">end</span>
13311267         <span class="keyword">end</span>
13321268         Tabchar=<a href="cell2tab.html" class="code" title="function Tabchar=cell2tab(Tabcell,separator)">cell2tab</a>(Tabcell,<span class="string">'='</span>);
13331269     <span class="keyword">end</span>
13341270 <span class="keyword">else</span>
13351271 <span class="comment">%list attribute names and values associated to the variable # injdex-1</span>
13361272     list_var=get(handles.variables,<span class="string">'String'</span>);
13371273     var_select=list_var{index};
13381274     set(handles.attributes_txt,<span class="string">'String'</span>, [<span class="string">'attributes of '</span> var_select])
13391275     <span class="keyword">if</span> isfield(Field,<span class="string">'VarAttribute'</span>)&amp; length(Field.VarAttribute)&gt;=index-1
13401276 <span class="comment">%         nbline=0;</span>
13411277         VarAttr=Field.VarAttribute{index-1};
13421278         <span class="keyword">if</span> isstruct(VarAttr)
13431279             attr_list=fieldnames(VarAttr);
13441280             <span class="keyword">for</span> iline=1:length(attr_list)
13451281                 Tabcell{iline,1}=attr_list{iline};
13461282                 eval([<span class="string">'val=VarAttr.'</span> attr_list{iline} <span class="string">';'</span>])
13471283                 <span class="keyword">if</span> ischar(val);
13481284                     Tabcell{iline,2}=val;
13491285                 <span class="keyword">else</span>
13501286                      Tabcell{iline,2}=num2str(val);
13511287                 <span class="keyword">end</span>
13521288             <span class="keyword">end</span>
13531289         <span class="keyword">end</span>
13541290     <span class="keyword">end</span>
13551291
13561292 <span class="keyword">end</span>
13571293 <span class="keyword">if</span> ~isempty(Tabcell)
13581294     Tabchar=<a href="cell2tab.html" class="code" title="function Tabchar=cell2tab(Tabcell,separator)">cell2tab</a>(Tabcell,<span class="string">'='</span>);
13591295     Tabchar=[{<span class="string">''</span>};Tabchar];
13601296 <span class="keyword">end</span>
13611297 set(handles.attributes,<span class="string">'String'</span>,Tabchar);
13621298
13631299 <span class="comment">% list_var=get(handles.dimensions,'String');</span>
13641300 <span class="comment">% val=get(handles.dimensions,'Value');</span>
13651301
13661302 <span class="comment">% update dimensions;</span>
13671303 <span class="keyword">if</span> isfield(Field,<span class="string">'VarDimIndex'</span>)
13681304     Tabdim={};<span class="comment">%default</span>
13691305     <span class="keyword">if</span> isequal(index,1)
13701306         dim_indices=1:length(Field.ListDimName);
13711307         set(handles.dimensions_txt,<span class="string">'String'</span>, <span class="string">'dimensions'</span>)
13721308     <span class="keyword">else</span>
13731309         dim_indices=Field.VarDimIndex{index-1};
13741310         set(handles.dimensions_txt,<span class="string">'String'</span>, [<span class="string">'dimensions of '</span> var_select])
13751311     <span class="keyword">end</span>
13761312     <span class="keyword">for</span> iline=1:length(dim_indices)
13771313         Tabdim{iline,1}=Field.ListDimName{dim_indices(iline)};
13781314         Tabdim{iline,2}=num2str(Field.DimValue(dim_indices(iline)));
13791315     <span class="keyword">end</span>
13801316     Tabchar=<a href="cell2tab.html" class="code" title="function Tabchar=cell2tab(Tabcell,separator)">cell2tab</a>(Tabdim,<span class="string">'='</span>);
13811317     Tabchar=[{<span class="string">''</span>} ;Tabchar];
13821318     set(handles.dimensions,<span class="string">'String'</span>,Tabchar) 
13831319 <span class="keyword">end</span> 
13841320
13851321 <span class="comment">% --- Executes on button press in check_1Dplot.</span>
13861322 <a name="_sub18" href="#_subfunctions" class="code">function check_1Dplot_Callback(hObject, eventdata, handles)</a>
13871323 val=get(handles.check_1Dplot,<span class="string">'Value'</span>);
13881324 <span class="keyword">if</span> isequal(val,0)
13891325     set(handles.Panel1Dplot,<span class="string">'Visible'</span>,<span class="string">'off'</span>)
13901326 <span class="comment">%      set(handles.scalar,'Visible','off')</span>
13911327 <span class="comment">%     set(handles.ordinate,'Max',2.0)%allow multiple ordinate input option</span>
13921328 <span class="comment">%     if isequal(get(handles.check_vector,'Value'),0);</span>
13931329 <span class="comment">%         set(handles.coord_z_vectors_scalar,'Visible','off')</span>
13941330 <span class="comment">%     end</span>
13951331 <span class="keyword">else</span>
13961332     set(handles.Panel1Dplot,<span class="string">'Visible'</span>,<span class="string">'on'</span>)
13971333 <span class="comment">%     set(handles.scalar,'Visible','on')</span>
13981334 <span class="comment">%     val=get(handles.ordinate,'Value');</span>
13991335 <span class="comment">%     val=val(1);</span>
14001336 <span class="comment">%     set(handles.ordinate,'Value',val);%suppress multiple ordinates</span>
14011337 <span class="comment">%     set(handles.ordinate,'Max',1.0);%suppress multiple ordinate input option</span>
14021338 <span class="comment">%       set(handles.coord_z_vectors_scalar,'Visible','on')</span>
14031339 <span class="keyword">end</span>
14041340
14051341 <span class="comment">% --- Executes on button press in check_scalar.</span>
14061342 <a name="_sub19" href="#_subfunctions" class="code">function check_scalar_Callback(hObject, eventdata, handles)</a>
14071343 val=get(handles.check_scalar,<span class="string">'Value'</span>);
14081344 <span class="keyword">if</span> isequal(val,0)
14091345     set(handles.PanelScalar,<span class="string">'Visible'</span>,<span class="string">'off'</span>)
14101346 <span class="comment">%      set(handles.scalar,'Visible','off')</span>
14111347 <span class="comment">%     set(handles.ordinate,'Max',2.0)%allow multiple ordinate input option</span>
14121348 <span class="comment">%     if isequal(get(handles.check_vector,'Value'),0);</span>
14131349 <span class="comment">%         set(handles.coord_z_vectors_scalar,'Visible','off')</span>
14141350 <span class="comment">%     end</span>
14151351 <span class="keyword">else</span>
14161352     set(handles.PanelScalar,<span class="string">'Visible'</span>,<span class="string">'on'</span>)
14171353 <span class="comment">%     set(handles.scalar,'Visible','on')</span>
14181354 <span class="comment">%     val=get(handles.ordinate,'Value');</span>
14191355 <span class="comment">%     val=val(1);</span>
14201356 <span class="comment">%     set(handles.ordinate,'Value',val);%suppress multiple ordinates</span>
14211357 <span class="comment">%     set(handles.ordinate,'Max',1.0);%suppress multiple ordinate input option</span>
14221358 <span class="comment">%       set(handles.coord_z_vectors_scalar,'Visible','on')</span>
14231359 <span class="keyword">end</span>
14241360
14251361 <span class="comment">%---------------------------</span>
14261362 <span class="comment">% --- Executes on button press in check_vector.</span>
14271363 <a name="_sub20" href="#_subfunctions" class="code">function check_vector_Callback(hObject, eventdata, handles)</a>
14281364 val=get(handles.check_vector,<span class="string">'Value'</span>);
14291365 <span class="keyword">if</span> isequal(val,0)
14301366     set(handles.PanelVectors,<span class="string">'Visible'</span>,<span class="string">'off'</span>)
14311367 <span class="keyword">else</span>
14321368     set(handles.PanelVectors,<span class="string">'Visible'</span>,<span class="string">'on'</span>)
14331369 <span class="keyword">end</span>
14341370
14351371
14361372
14371373 <span class="comment">%-----------------------------</span>
14381374 <a name="_sub21" href="#_subfunctions" class="code">function mouse_up_gui(ggg,eventdata,handles)</a>
14391375 <span class="keyword">if</span> isequal(get(ggg,<span class="string">'SelectionType'</span>),<span class="string">'alt'</span>)
14401376     message=<span class="string">''</span>
14411377     <span class="keyword">global</span> CurData
14421378     inputfield=get(handles.inputfile,<span class="string">'String'</span>);
14431379     <span class="keyword">if</span> exist(inputfield,<span class="string">'file'</span>)
14441380         CurData=<a href="nc2struct.html" class="code" title="function [Data,var_detect,ichoice]=nc2struct(nc,ListVarName)">nc2struct</a>(inputfield);
14451381     <span class="keyword">else</span>
14461382         CurData=get(ggg,<span class="string">'UserData'</span>);<span class="comment">% get_field opened from a input field, not a file</span>
14471383     <span class="keyword">end</span>
14481384   <span class="comment">%%%% TODO: put the matalb command window in front</span>
14491385     evalin(<span class="string">'base'</span>,<span class="string">'global CurData'</span>)<span class="comment">%make CurData global in the workspace</span>
14501386     evalin(<span class="string">'base'</span>,<span class="string">'CurData'</span>) <span class="comment">%display CurData in the workspace</span>
14511387 <span class="keyword">end</span>
14521388
14531389 <span class="comment">%---------------------------------------------</span>
14541390 <span class="comment">% --- Executes on selection change in ACTION.</span>
14551391 <a name="_sub22" href="#_subfunctions" class="code">function ACTION_Callback(hObject, eventdata, handles)</a>
14561392 list_ACTION=get(handles.ACTION,<span class="string">'String'</span>);<span class="comment">% list menu fields</span>
14571393 index_ACTION=get(handles.ACTION,<span class="string">'Value'</span>);<span class="comment">% selected string index</span>
14581394 ACTION= list_ACTION{index_ACTION}; <span class="comment">% selected string</span>
14591395 path_get_field=which(<span class="string">'get_field'</span>);<span class="comment">%path to series.m</span>
14601396 list_path=get(handles.ACTION,<span class="string">'UserData'</span>);
14611397 nb_builtin=0;
14621398 <span class="keyword">for</span> ilist=1:length(list_path)
14631399     <span class="keyword">if</span> isequal(list_path{ilist},path_get_field)
14641400         nb_builtin=nb_builtin+1;
14651401     <span class="keyword">else</span>
14661402         <span class="keyword">break</span>
14671403     <span class="keyword">end</span>
14681404 <span class="keyword">end</span>
14691405 <span class="keyword">if</span> nb_builtin==0<span class="comment">% the path to get_field has been changed, reinitialize</span>
14701406     <a href="#_sub1" class="code" title="subfunction get_field_OpeningFcn(hObject, eventdata, handles,filename,Field,haxes)">get_field_OpeningFcn</a>(hObject, eventdata, handles)
14711407     <span class="keyword">return</span>
14721408 <span class="keyword">end</span>
14731409
14741410 <span class="comment">% add a new function to the menu</span>
14751411 <span class="keyword">if</span> isequal(ACTION,<span class="string">'more...'</span>)
14761412     pathfct=fileparts(path_get_field);
14771413     browse_name=fullfile(path_get_field,<span class="string">'FIELD_FCT'</span>);
14781414     <span class="keyword">if</span> length(list_path)&gt;nb_builtin
14791415         browse_name=list_path{end};<span class="comment">% initialize browser with  the path of the last introduced function</span>
14801416     <span class="keyword">end</span>
14811417 <span class="comment">%     fct_name='';</span>
14821418 <span class="comment">%     dir_perso=prefdir;</span>
14831419 <span class="comment">%     profil_perso=fullfile(dir_perso,'uvmat_perso.mat');</span>
14841420 <span class="comment">%     display(profil_perso)</span>
14851421 <span class="comment">%     if exist(profil_perso,'file')</span>
14861422 <span class="comment">%           h=load (profil_perso);</span>
14871423 <span class="comment">%           if isfield(h,'get_field_fct')</span>
14881424 <span class="comment">%             fct_name=h.get_field_fct;</span>
14891425 <span class="comment">%           end</span>
14901426 <span class="comment">%     else</span>
14911427 <span class="comment">%         path_to_uvmat=which ('uvmat');% check the path of uvmat</span>
14921428 <span class="comment">%         pathfct=fileparts(path_to_uvmat);</span>
14931429 <span class="comment">%         fct_name=fullfile(pathfct,'USR_FCT');%go to UVMAT/USR_FCT by default</span>
14941430 <span class="comment">%     end</span>
14951431     [FileName, PathName] = uigetfile( <span class="keyword">...</span>
14961432        {<span class="string">'*.m'</span>, <span class="string">' (*.m)'</span>;
14971433         <span class="string">'*.m'</span><span class="string">'.m files '</span>; <span class="keyword">...</span>
14981434         <span class="string">'*.*'</span>, <span class="string">'All Files (*.*)'</span>}, <span class="keyword">...</span>
14991435         <span class="string">'Pick a file'</span>,browse_name);
15001436     <span class="keyword">if</span> length(FileName)&lt;2
15011437         <span class="keyword">return</span>
15021438     <span class="keyword">end</span>
15031439     ext_fct=FileName(end-1:end);
15041440     <span class="keyword">if</span> ~isequal(ext_fct,<span class="string">'.m'</span>)
15051441         <a href="msgbox_uvmat.html" class="code" title="function varargout = msgbox_uvmat(varargin)">msgbox_uvmat</a>(<span class="string">'ERROR'</span>,<span class="string">'a Matlab function .m must be introduced'</span>);
15061442         <span class="keyword">return</span>
15071443     <span class="keyword">end</span>
15081444     ACTION=FileName(1:end-2);<span class="comment">% ACTION choice updated by the selected item</span>
15091445     
15101446     <span class="comment">% insert the choice in the action menu</span>
15111447    menu_str=<a href="update_menu.html" class="code" title="function menu_str=update_menu(handle,strinput)">update_menu</a>(handles.ACTION,ACTION);<span class="comment">%new action menu in which the new item has been appended if needed</span>
15121448    index_ACTION=get(handles.ACTION,<span class="string">'Value'</span>);<span class="comment">% currently selected index in the list</span>
15131449    list_path{index_ACTION}=PathName;
15141450    <span class="keyword">if</span> length(menu_str)&gt;nb_builtin+5;
15151451        nbremove=length(menu_str)-nb_builtin-5;
15161452        menu_str(nb_builtin+1:end-5)=[];
15171453        list_path(nb_builtin+1:end-4)=[];
15181454        index_ACTION=index_ACTION-nbremove;
15191455        set(handles.ACTION,<span class="string">'Value'</span>,index_ACTION)
15201456        set(handles.ACTION,<span class="string">'String'</span>,menu_str)
15211457    <span class="keyword">end</span>
15221458    list_path{index_ACTION}=PathName;
15231459    set(handles.ACTION,<span class="string">'UserData'</span>,list_path);
15241460    set(handles.path_action,<span class="string">'enable'</span>,<span class="string">'inactive'</span>)<span class="comment">% indicate that the current path is accessible (not 'off')</span>
15251461   
15261462    <span class="comment">%record the current menu in personal file profil_perso</span>
15271463    dir_perso=prefdir;
15281464    profil_perso=fullfile(dir_perso,<span class="string">'uvmat_perso.mat'</span>);
15291465    <span class="keyword">for</span> ilist=nb_builtin+1:length(menu_str)-1
15301466        get_field_fct{ilist-nb_builtin}=fullfile(list_path{ilist},[menu_str{ilist} <span class="string">'.m'</span>]);
15311467    <span class="keyword">end</span>
15321468    <span class="keyword">if</span> exist(profil_perso,<span class="string">'file'</span>)
15331469         save(profil_perso,<span class="string">'get_field_fct'</span>,<span class="string">'-append'</span>)
15341470    <span class="keyword">else</span>
15351471         txt=ver;
15361472         Release=txt(1).Release;
15371473         relnumb=str2num(Release(3:4));
15381474         <span class="keyword">if</span> relnumb &gt;= 14
15391475             save(profil_perso,<span class="string">'get_field_fct'</span>,<span class="string">'-V6'</span>)
15401476         <span class="keyword">else</span>
15411477             save(profil_perso, <span class="string">'get_field_fct'</span>)
15421478         <span class="keyword">end</span>
15431479    <span class="keyword">end</span>
15441480 <span class="keyword">end</span>
15451481
15461482    <span class="comment">%check the current path to the selected function</span>
15471483 PathName=list_path{index_ACTION};<span class="comment">%current recorded path</span>
15481484 <span class="keyword">if</span> ~isequal(path_get_field,PathName)
15491485     CurrentPath=fileparts(which(ACTION));
15501486     <span class="keyword">if</span> ~isequal(PathName,CurrentPath)
15511487         addpath(PathName)
15521488         errormsg=<a href="check_functions.html" class="code" title="function [errormsg,date_str]=check_functions">check_functions</a>;
15531489         <a href="msgbox_uvmat.html" class="code" title="function varargout = msgbox_uvmat(varargin)">msgbox_uvmat</a>(<span class="string">'CONFIRMATION'</span>,[[<span class="string">'path '</span> PathName <span class="string">' added to the current Matlab pathes'</span>];errormsg])
15541490     <span class="keyword">end</span>
15551491 <span class="keyword">end</span>
15561492 set(handles.path_action,<span class="string">'String'</span>,PathName); <span class="comment">%show the path to the senlected function</span>
15571493     
15581494     
15591495 <span class="comment">%     fct_name=fullfile(PathName, FileName);</span>
15601496 <span class="comment">%     if ~exist(fct_name,'file')</span>
15611497 <span class="comment">%            msgbox_uvmat('ERROR',['procesing fct ' fct_name ' not found'])</span>
15621498 <span class="comment">%     else</span>
15631499 <span class="comment">%        ACTION=FileName(1:end-2);%</span>
15641500 <span class="comment">%        menu=update_menu(handles.ACTION,ACTION);%add the selected fct to the menu</span>
15651501 <span class="comment">%        index_ACTION=get(handles.ACTION,'Value');% selected string index</span>
15661502 <span class="comment">%        list_path{index_ACTION}=PathName;</span>
15671503 <span class="comment">%        set(handles.ACTION,'UserData',list_path)</span>
15681504 <span class="comment">%        if exist(profil_perso,'file')</span>
15691505 <span class="comment">%             save (profil_perso,'coord_fct','-append'); %store the root name for future opening of uvmat</span>
15701506 <span class="comment">%         end</span>
15711507 <span class="comment">%     end</span>
15721508 <span class="comment">%</span>
15731509 <span class="comment">%</span>
15741510 <span class="comment">%     fileinput=FileName;%complete file name</span>
15751511 <span class="comment">%     eval(['spath=which(''' FileName ''');'])% current path to the function FileName</span>
15761512 <span class="comment">%     if ~isequal(spath,PathName)</span>
15771513 <span class="comment">%         addpath(PathName)</span>
15781514 <span class="comment">%     end</span>
15791515 <span class="comment">%     FileName([end-1:end])=[];</span>
15801516 <span class="comment">%</span>
15811517 <span class="comment">%    % insert the choice in the action menu</span>
15821518 <span class="comment">%     nbACTION=length(list_ACTION);</span>
15831519 <span class="comment">%     index=0;</span>
15841520 <span class="comment">%     for ilist=1:nbACTION</span>
15851521 <span class="comment">%        if isequal(FileName,list_ACTION{ilist})%look for the selected scalar in the fields_input menu</span>
15861522 <span class="comment">%             index=ilist;%</span>
15871523 <span class="comment">%        end</span>
15881524 <span class="comment">%     end</span>
15891525 <span class="comment">%     if index==0</span>
15901526 <span class="comment">%        list_ACTION{nbACTION}=FileName; %put the chosen fct at the penultimate place in the fields_input menu</span>
15911527 <span class="comment">%        list_path{nbACTION}=PathName;</span>
15921528 <span class="comment">%        index=nbACTION;</span>
15931529 <span class="comment">%        list_ACTION{nbACTION+1}='more...';</span>
15941530 <span class="comment">%        set(handles.ACTION,'String',list_ACTION)</span>
15951531 <span class="comment">%     end</span>
15961532 <span class="comment">%     set(handles.ACTION,'Value',index);% store the selected scalar type</span>
15971533 <span class="comment">%     set(handles.ACTION,'UserData',list_path);</span>
15981534 <span class="comment">%     usr_defined_fct=fct_name;</span>
15991535 <span class="comment">%     nbmenu=length(list_ACTION);</span>
16001536 <span class="comment">%     nbadd=nbmenu-5;</span>
16011537 <span class="comment">%     ilist=0;</span>
16021538 <span class="comment">%     for imenu=nbmenu-min(4,nbadd):nbmenu-1</span>
16031539 <span class="comment">%       ilist=ilist+1;</span>
16041540 <span class="comment">%       fct_get_field{ilist,1}=list_ACTION{imenu};</span>
16051541 <span class="comment">%       fct_path_get_field{ilist}=list_path{imenu};</span>
16061542 <span class="comment">%     end</span>
16071543 <span class="comment">%     if exist(profil_perso,'file')</span>
16081544 <span class="comment">%         save(profil_perso,'usr_defined_fct','fct_get_field','fct_path_get_field','-append')</span>
16091545 <span class="comment">%     else</span>
16101546 <span class="comment">%        save(profil_perso,'usr_defined_fct','fct_get_field','fct_path_get_field','-V6')</span>
16111547 <span class="comment">%     end</span>
16121548 <span class="comment">% end</span>
16131549
16141550 <span class="comment">% %check the current path to the selected function</span>
16151551 <span class="comment">% list_path</span>
16161552 <span class="comment">% PathName=list_path{index_ACTION}</span>
16171553 <span class="comment">% CurrentPath=fileparts(which(ACTION))</span>
16181554 <span class="comment">% if ~isequal(PathName,CurrentPath)</span>
16191555 <span class="comment">%     addpath(PathName)</span>
16201556 <span class="comment">%     errormsg=check_functions;</span>
16211557 <span class="comment">%     msgbox_uvmat('WARNING',[['path ' PathName ' added to the current Matlab pathes'];errormsg])</span>
16221558 <span class="comment">% end</span>
16231559 <span class="comment">% set(handles.path_action,'String',fullfile(PathName,' ')); %show the path to the senlected function</span>
16241560
16251561 <span class="comment">%default setting for the visibility of the GUI elements*</span>
16261562 <span class="keyword">if</span> ~isequal(ACTION,<span class="string">'PLOT'</span>)
16271563     varargout=feval(ACTION);<span class="comment">% input list asked by the selected function</span>
16281564     test_1Dplot=[];
16291565     test_scalar=[];
16301566     test_vector=[];
16311567     <span class="keyword">for</span> ilist=1:length(varargout)-1
16321568         <span class="keyword">switch</span> varargout{ilist}
16331569                            <span class="comment">%RootFile always visible</span>
16341570             <span class="keyword">case</span> <span class="string">'check_1Dplot'</span>   
16351571                  test_1Dplot=isequal(lower(varargout{ilist+1}),<span class="string">'y'</span>);
16361572             <span class="keyword">case</span> <span class="string">'check_scalar'</span>
16371573                  test_scalar=isequal(lower(varargout{ilist+1}),<span class="string">'y'</span>);   
16381574             <span class="keyword">case</span> <span class="string">'check_vector'</span>   
16391575                  test_vector=isequal(lower(varargout{ilist+1}),<span class="string">'y'</span>);
16401576         <span class="keyword">end</span>
16411577     <span class="keyword">end</span>
16421578     <span class="keyword">if</span> test_1Dplot==0
16431579         set(handles.check_1Dplot,<span class="string">'Value'</span>,0);
16441580     <span class="keyword">end</span>
16451581     <span class="keyword">if</span> test_1Dplot==1
16461582         set(handles.check_1Dplot,<span class="string">'Value'</span>,1);
16471583     <span class="keyword">end</span>
16481584     <span class="keyword">if</span> test_scalar==0
16491585         set(handles.check_scalar,<span class="string">'Value'</span>,0);
16501586     <span class="keyword">end</span>
16511587     <span class="keyword">if</span> test_scalar==1
16521588         set(handles.check_scalar,<span class="string">'Value'</span>,1);
16531589     <span class="keyword">end</span>
16541590     <span class="keyword">if</span> test_vector==0
16551591         set(handles.check_vector,<span class="string">'Value'</span>,0);
16561592     <span class="keyword">end</span>
16571593     <span class="keyword">if</span> test_vector==1
16581594         set(handles.check_vector,<span class="string">'Value'</span>,1);
16591595     <span class="keyword">end</span>
16601596     <a href="#_sub18" class="code" title="subfunction check_1Dplot_Callback(hObject, eventdata, handles)">check_1Dplot_Callback</a>(hObject, eventdata, handles)
16611597     <a href="#_sub19" class="code" title="subfunction check_scalar_Callback(hObject, eventdata, handles)">check_scalar_Callback</a>(hObject, eventdata, handles)
16621598     <a href="#_sub20" class="code" title="subfunction check_vector_Callback(hObject, eventdata, handles)">check_vector_Callback</a>(hObject, eventdata, handles)
16631599 <span class="keyword">end</span>
16641600 <span class="comment">%</span>
16651601 <span class="comment">% % --- Executes on selection change in menu_coord.</span>
16661602 <span class="comment">% function menu_coord_Callback(hObject, eventdata, handles)</span>
16671603 <span class="comment">% hget_field=get(handles.menu_coord,'parent');</span>
16681604 <span class="comment">% menu=get(handles.menu_coord,'String');</span>
16691605 <span class="comment">% ind_coord=get(handles.menu_coord,'Value');</span>
16701606 <span class="comment">% coord_option=menu{ind_coord};</span>
16711607 <span class="comment">% if isequal(coord_option,'more...');</span>
16721608 <span class="comment">%     fct_name='';</span>
16731609 <span class="comment">%     if exist('./TMP/current_usr_fct.mat','file')% if a file is found</span>
16741610 <span class="comment">%         h=load('./TMP/current_usr_fct.mat');</span>
16751611 <span class="comment">%         if isfield(h,'fct_name');</span>
16761612 <span class="comment">%             fct_name=h.fct_name;</span>
16771613 <span class="comment">%         end</span>
16781614 <span class="comment">%     end</span>
16791615 <span class="comment">%     prompt = {'Enter the name of the transform function'};</span>
16801616 <span class="comment">%     dlg_title = 'user defined transform';</span>
16811617 <span class="comment">%     num_lines= 1;</span>
16821618 <span class="comment">%     [FileName, PathName, filterindex] = uigetfile( ...</span>
16831619 <span class="comment">%        {'*.m', ' (*.m)';</span>
16841620 <span class="comment">%         '*.m',  '.m files '; ...</span>
16851621 <span class="comment">%         '*.*', 'All Files (*.*)'}, ...</span>
16861622 <span class="comment">%         'Pick a file', fct_name);</span>
16871623 <span class="comment">%     fct_name=fullfile(PathName,FileName);</span>
16881624 <span class="comment">%     addpath(PathName);%add the path to the selected fct</span>
16891625 <span class="comment">%     [errormsg,date_str]=check_functions;%check whether new functions can oversed the uvmat package A UTILISER</span>
16901626 <span class="comment">%     if ~exist(fct_name,'file')</span>
16911627 <span class="comment">%            warndlg_uvmat(['image procesing fct ' fct_name ' not found'],'WARNING')</span>
16921628 <span class="comment">%     else</span>
16931629 <span class="comment">%         transform=FileName(1:end-2);%</span>
16941630 <span class="comment">%         menu=update_menu(handles.menu_coord,transform);%add the selected fct to the menu</span>
16951631 <span class="comment">% %         set(handles.mouse_coord,'String',menu([1:end-1])')%update the mouse coord menu</span>
16961632 <span class="comment">%       save ('./TMP/current_usr_fct.mat','fct_name');</span>
16971633 <span class="comment">%     end</span>
16981634 <span class="comment">% end</span>
16991635
17001636 <span class="comment">% --- Executes on selection change in menu_coord.</span>
17011637 <a name="_sub23" href="#_subfunctions" class="code">function HELP_Callback(hObject, eventdata, handles)</a>
17021638 path_to_uvmat=which (<span class="string">'uvmat'</span>);<span class="comment">% check the path of uvmat</span>
17031639 pathelp=fileparts(path_to_uvmat);
17041640 helpfile=fullfile(pathelp,<span class="string">'UVMAT_DOC'</span>,<span class="string">'uvmat_doc.html'</span>);
17051641 <span class="keyword">if</span> isempty(dir(helpfile)), errordlg(<span class="string">'Please put the help file uvmat_doc.html in the directory UVMAT/UVMAT_DOC'</span>)
17061642 <span class="keyword">else</span>
17071643 web([helpfile <span class="string">'#get_field'</span>])   
17081644 <span class="keyword">end</span>
17091645
17101646 <span class="comment">%-----------------------------------------------------</span>
17111647 <span class="comment">% --- browse existing figures</span>
17121648 <span class="comment">%-----------------------------------------------------</span>
17131649 <a name="_sub24" href="#_subfunctions" class="code">function browse_fig(menu_handle)</a>
17141650 hh=findobj(allchild(0),<span class="string">'Type'</span>,<span class="string">'figure'</span>);
17151651 ilist=0;
17161652 list={};
17171653 <span class="keyword">for</span> ifig=1:length(hh)  <span class="comment">%look for all existing figures</span>
17181654     name=get(hh(ifig),<span class="string">'Name'</span>);
17191655      <span class="keyword">if</span> ~isequal(name,<span class="string">'uvmat'</span>)<span class="comment">%case of uvmat GUI</span>
17201656 <span class="comment">%         ilist=ilist+1;</span>
17211657 <span class="comment">%         list{ilist,1}='uvmat';</span>
17221658 <span class="comment">%     else        %other figures</span>
17231659         hchild=get(hh(ifig),<span class="string">'children'</span>);<span class="comment">% look for axes contained in each figure</span>
17241660         nbaxe=0;
17251661         <span class="keyword">for</span> ichild=1:length(hchild)           
17261662             Type=get(hchild(ichild),<span class="string">'Type'</span>);
17271663             Tag=get(hchild(ichild),<span class="string">'Tag'</span>);
17281664             <span class="keyword">if</span> isequal(Type,<span class="string">'axes'</span>)
17291665                 <span class="keyword">if</span> ~isequal(Tag,<span class="string">'Colorbar'</span>)&amp; ~isequal(Tag,<span class="string">'legend'</span>)<span class="comment">% don't select colorbars for plotting</span>
17301666                      nbaxe=nbaxe+1;<span class="comment">%count the existing axis</span>
17311667                 <span class="keyword">end</span> 
17321668             <span class="keyword">end</span>
17331669         <span class="keyword">end</span>   
17341670         <span class="keyword">if</span> nbaxe==1
17351671              ilist=ilist+1;<span class="comment">%add a line in the list of axis</span>
17361672             list{ilist,1}=num2str(hh(ifig));
17371673         <span class="keyword">elseif</span> nbaxe&gt;1
17381674             <span class="keyword">for</span> iaxe=1:nbaxe
17391675                ilist=ilist+1;<span class="comment">%add a line in the list of axis</span>
17401676                list{ilist,1}=[num2str(hh(ifig)) <span class="string">'_'</span> num2str(iaxe)];
17411677             <span class="keyword">end</span>
17421678         <span class="keyword">end</span>
17431679      <span class="keyword">end</span>
17441680 <span class="keyword">end</span>
17451681 list=[<span class="string">'new fig...'</span>;<span class="string">'uvmat'</span>;list];
17461682 set(menu_handle,<span class="string">'Value'</span>,1)
17471683 set(menu_handle,<span class="string">'String'</span>,list)
17481684
17491685
17501686 <span class="comment">%-----------------------------------------------------</span>
17511687 <a name="_sub25" href="#_subfunctions" class="code">function list_fig_Callback(hObject, eventdata, handles)</a>
17521688 <span class="comment">%-----------------------------------------------------</span>
17531689 list_fig=get(handles.list_fig,<span class="string">'String'</span>);
17541690 fig_val=get(handles.list_fig,<span class="string">'Value'</span>);
17551691 plot_fig=list_fig{fig_val};
17561692 <span class="keyword">if</span> isequal(plot_fig,<span class="string">'uvmat'</span>)
17571693     huvmat=findobj(allchild(0),<span class="string">'name'</span>,<span class="string">'uvmat'</span>);
17581694     <span class="keyword">if</span> ~isempty(huvmat)
17591695         uistack(huvmat,<span class="string">'top'</span>)
17601696     <span class="keyword">end</span>   
17611697 <span class="keyword">elseif</span> ~isequal(plot_fig,<span class="string">'new fig...'</span>) &amp; ~isequal(plot_fig,<span class="string">'uvmat'</span>)
17621698     sep=regexp(plot_fig,<span class="string">'_'</span>);
17631699     <span class="keyword">if</span> ~isempty(sep)
17641700         plot_fig=plot_fig([1:sep-1]);
17651701     <span class="keyword">end</span>
17661702     <span class="keyword">if</span> ishandle(str2num(plot_fig))
17671703         figure(str2num(plot_fig))<span class="comment">% display existing figure</span>
17681704     <span class="keyword">else</span>
17691705         <a href="#_sub24" class="code" title="subfunction browse_fig(menu_handle)">browse_fig</a>(handles.list_fig); <span class="comment">%reset the current list of figures</span>
17701706     <span class="keyword">end</span>
17711707 <span class="keyword">end</span>
17721708
17731709
17741710 <span class="comment">%-------------------------------------------------</span>
17751711 <span class="comment">% give index numbers of the strings str in the list ListvarName</span>
17761712 <a name="_sub26" href="#_subfunctions" class="code">function VarIndex_y=name2index(cell_str,ListVarName)</a>
17771713 VarIndex_y=[];
17781714 <span class="keyword">if</span> ischar(cell_str)
17791715     <span class="keyword">for</span> ivar=1:length(ListVarName)
17801716         varlist=ListVarName{ivar};
17811717         <span class="keyword">if</span> isequal(varlist,cell_str)
17821718             VarIndex_y= ivar;
17831719             <span class="keyword">break</span>
17841720         <span class="keyword">end</span>
17851721     <span class="keyword">end</span>
17861722 <span class="keyword">elseif</span> iscell(cell_str)
17871723     <span class="keyword">for</span> isel=1:length(cell_str)
17881724         varsel=cell_str{isel};
17891725         <span class="keyword">for</span> ivar=1:length(ListVarName)
17901726             varlist=ListVarName{ivar};
17911727             <span class="keyword">if</span> isequal(varlist,varsel)
17921728                 VarIndex_y=[VarIndex_y ivar];
17931729             <span class="keyword">end</span>
17941730         <span class="keyword">end</span>
17951731     <span class="keyword">end</span>
17961732 <span class="keyword">end</span>
17971733
17981734
17991735 <span class="comment">% --- Executes on selection change in vector_z.</span>
18001736 <a name="_sub27" href="#_subfunctions" class="code">function vector_z_Callback(hObject, eventdata, handles)</a>
18011737 Aindex=get(handles.vector_z,<span class="string">'Value'</span>);
18021738 Astring=get(handles.vector_z,<span class="string">'String'</span>);
18031739 VarName=Astring{Aindex};
18041740 <a href="#_sub11" class="code" title="subfunction update_field(hObject, eventdata, handles,VarName)">update_field</a>(hObject, eventdata, handles,VarName)
18051741
18061742 <span class="comment">% --- Executes on selection change in coord_z_scalar.</span>
18071743 <a name="_sub28" href="#_subfunctions" class="code">function coord_z_scalar_Callback(hObject, eventdata, handles)</a>
18081744 hselect_field=get(handles.inputfile,<span class="string">'parent'</span>);
18091745 Field=get(hselect_field,<span class="string">'UserData'</span>);
18101746 list=get(handles.coord_z_scalar,<span class="string">'String'</span>);
18111747 yindex=get(handles.coord_z_scalar,<span class="string">'Value'</span>);
18121748 xindex=<a href="#_sub26" class="code" title="subfunction VarIndex_y=name2index(cell_str,ListVarName)">name2index</a>(list{yindex(1)},Field.ListVarName);
18131749 <span class="keyword">if</span> ~isempty(xindex)
18141750     set(handles.variables,<span class="string">'Value'</span>,xindex+1)
18151751     <a href="#_sub17" class="code" title="subfunction variables_Callback(hObject, eventdata, handles)">variables_Callback</a>(hObject, eventdata, handles)
18161752 <span class="keyword">end</span>
18171753 Field.VarIndex.z=xindex;
18181754 set(hselect_field,<span class="string">'UserData'</span>,Field);
18191755
18201756 <span class="comment">% --- Executes on selection change in coord_x_vectors.</span>
18211757 <a name="_sub29" href="#_subfunctions" class="code">function coord_x_scalar_Callback(hObject, eventdata, handles)</a>
18221758
18231759 <span class="comment">% --- Executes on selection change in coord_x_vectors.</span>
18241760 <a name="_sub30" href="#_subfunctions" class="code">function coord_y_scalar_Callback(hObject, eventdata, handles)</a>
18251761
18261762
18271763 <span class="comment">% --- Executes on selection change in coord_y_vectors.</span>
18281764 <a name="_sub31" href="#_subfunctions" class="code">function coord_y_vectors_Callback(hObject, eventdata, handles)</a>
18291765
18301766 <span class="comment">% --- Executes on selection change in coord_x_vectors.</span>
18311767 <a name="_sub32" href="#_subfunctions" class="code">function coord_x_vectors_Callback(hObject, eventdata, handles)</a>
18321768
18331769
18341770
18351771
18361772 <span class="comment">% --- Executes on selection change in vec_color.</span>
18371773 <a name="_sub33" href="#_subfunctions" class="code">function vec_color_Callback(hObject, eventdata, handles)</a>
18381774
18391775
18401776 <span class="comment">% --------------------------------------------------------------------</span>
18411777 <a name="_sub34" href="#_subfunctions" class="code">function MenuOpen_Callback(hObject, eventdata, handles)</a>
18421778 <span class="comment">% hObject    handle to MenuOpen (see GCBO)</span>
18431779 <span class="comment">% eventdata  reserved - to be defined in a future version of MATLAB</span>
18441780 <span class="comment">% handles    structure with handles and user data (see GUIDATA)</span>
18451781
18461782
18471783 <span class="comment">% --------------------------------------------------------------------</span>
18481784 <a name="_sub35" href="#_subfunctions" class="code">function MenuExport_Callback(hObject, eventdata, handles)</a>
18491785 <span class="comment">% hObject    handle to MenuExport (see GCBO)</span>
18501786 <span class="comment">% eventdata  reserved - to be defined in a future version of MATLAB</span>
18511787 <span class="comment">% handles    structure with handles and user data (see GUIDATA)</span>
18521788
18531789
18541790 <span class="comment">% --------------------------------------------------------------------</span>
18551791 <a name="_sub36" href="#_subfunctions" class="code">function MenuBrowse_Callback(hObject, eventdata, handles)</a>
18561792
18571793 oldfile=get(handles.inputfile,<span class="string">'String'</span>);
18581794 testrootfile=0;
18591795 testsubdir=0;
18601796 <span class="keyword">if</span> isempty(oldfile)|isequal(oldfile,<span class="string">''</span>) <span class="comment">%loads the previously stored file name and set it as default in the file_input box</span>
18611797         oldfile=<span class="string">''</span>;
18621798         dir_perso=prefdir;
18631799          profil_perso=fullfile(dir_perso,<span class="string">'uvmat_perso.mat'</span>);
18641800          <span class="keyword">if</span> exist(profil_perso,<span class="string">'file'</span>)
18651801               h=load (profil_perso);
18661802              <span class="keyword">if</span> isfield(h,<span class="string">'RootPath'</span>)
18671803                   RootPath=h.RootPath;
18681804              <span class="keyword">end</span>
18691805              <span class="keyword">if</span> isfield(h,<span class="string">'SubDir'</span>)
18701806                   SubDir=h.SubDir;
18711807                   <span class="keyword">if</span> ~isempty(SubDir)
18721808                     testsubdir=1;
18731809                   <span class="keyword">end</span>
18741810              <span class="keyword">end</span>
18751811              <span class="keyword">if</span> isfield(h,<span class="string">'RootFile'</span>)
18761812                   RootFile=h.RootFile;
18771813                   <span class="keyword">if</span> ~isempty(RootFile)
18781814                     testrootfile=1;
18791815                   <span class="keyword">end</span>
18801816              <span class="keyword">end</span>
18811817          <span class="keyword">end</span>
18821818 <span class="keyword">end</span>
18831819 <span class="keyword">if</span> testrootfile
18841820     <span class="keyword">if</span> ~testsubdir
18851821         oldfile=fullfile(RootPath,RootFile);
18861822     <span class="keyword">else</span>
18871823         oldfile=fullfile(RootPath,SubDir,RootFile);
18881824     <span class="keyword">end</span>
18891825 <span class="keyword">end</span>
18901826 [FileName, PathName] = uigetfile( <span class="keyword">...</span>
18911827        {<span class="string">'*.nc'</span>, <span class="string">' *.nc'</span>;<span class="keyword">...</span>
18921828        <span class="string">'*.cdf'</span>, <span class="string">' *.cdf'</span>;<span class="keyword">...</span>
18931829         <span class="string">'*.*'</span><span class="string">'All Files (*.*)'</span>}, <span class="keyword">...</span>
18941830         <span class="string">'Pick a file'</span>,oldfile);
18951831
18961832 <span class="comment">%global inputfile</span>
18971833 fileinput=[PathName FileName];<span class="comment">%complete file name</span>
18981834 testblank=findstr(fileinput,<span class="string">' '</span>);<span class="comment">%look for blanks</span>
18991835 <span class="keyword">if</span> ~isempty(testblank)
19001836     <a href="warndlg_uvmat.html" class="code" title="function hwarn=warndlg_uvmat(warntext,title)">warndlg_uvmat</a>([<span class="string">'The input file name '</span> fileinput <span class="string">' contains blank character : This is not allowed. Please change name'</span>],<span class="string">'ERROR'</span>)
19011837     <span class="keyword">return</span>
19021838 <span class="keyword">end</span>
19031839 sizf=size(fileinput);
19041840 <span class="keyword">if</span> (~ischar(fileinput)|~isequal(sizf(1),1)),<span class="keyword">return</span>;<span class="keyword">end</span>
19051841 set(handles.inputfile,<span class="string">'String'</span>,fileinput)
19061842 <a href="#_sub4" class="code" title="subfunction inputfile_Callback(hObject, eventdata, handles)">inputfile_Callback</a>(hObject, eventdata, handles)
19071843
19081844
19091845 <span class="comment">%update list of recent files in the menubar</span>
19101846 MenuFile_1=fileinput;
19111847 MenuFile_2=get(handles.MenuFile_1,<span class="string">'Label'</span>);
19121848 MenuFile_3=get(handles.MenuFile_2,<span class="string">'Label'</span>);
19131849 MenuFile_4=get(handles.MenuFile_3,<span class="string">'Label'</span>);
19141850 MenuFile_5=get(handles.MenuFile_4,<span class="string">'Label'</span>);
19151851 set(handles.MenuFile_1,<span class="string">'Label'</span>,MenuFile_1)
19161852 set(handles.MenuFile_2,<span class="string">'Label'</span>,MenuFile_2)
19171853 set(handles.MenuFile_3,<span class="string">'Label'</span>,MenuFile_3)
19181854 set(handles.MenuFile_4,<span class="string">'Label'</span>,MenuFile_4)
19191855 set(handles.MenuFile_5,<span class="string">'Label'</span>,MenuFile_5)
19201856
19211857
19221858 <span class="comment">% %store input file in personal file uvmat_perso.mat</span>
19231859 <span class="comment">% dir_perso=prefdir;</span>
19241860 <span class="comment">% profil_perso=fullfile(dir_perso,'uvmat_perso.mat');</span>
19251861 <span class="comment">% if exist(profil_perso,'file')</span>
19261862 <span class="comment">%     save (profil_perso,'RootPath','SubDir','RootFile','NomType', 'ext','-append'); %store the root name for future opening of uvmat</span>
19271863 <span class="comment">% else</span>
19281864 <span class="comment">%    save (profil_perso,'RootPath','SubDir','RootFile','NomType', 'ext'); %store the root name for future opening of uvmat</span>
19291865 <span class="comment">% end</span>
19301866
19311867
19321868 <span class="comment">% --------------------------------------------------------------------</span>
19331869 <a name="_sub37" href="#_subfunctions" class="code">function MenuFile_1_Callback(hObject, eventdata, handles)</a>
19341870 <span class="comment">% hObject    handle to MenuFile_1 (see GCBO)</span>
19351871 <span class="comment">% eventdata  reserved - to be defined in a future version of MATLAB</span>
19361872 <span class="comment">% handles    structure with handles and user data (see GUIDATA)</span>
19371873
19381874
19391875 <span class="comment">% --------------------------------------------------------------------</span>
19401876 <a name="_sub38" href="#_subfunctions" class="code">function MenuFile_2_Callback(hObject, eventdata, handles)</a>
19411877 <span class="comment">% hObject    handle to MenuFile_2 (see GCBO)</span>
19421878 <span class="comment">% eventdata  reserved - to be defined in a future version of MATLAB</span>
19431879 <span class="comment">% handles    structure with handles and user data (see GUIDATA)</span>
19441880
19451881
19461882 <span class="comment">% --------------------------------------------------------------------</span>
19471883 <a name="_sub39" href="#_subfunctions" class="code">function MenuFile_3_Callback(hObject, eventdata, handles)</a>
19481884 <span class="comment">% hObject    handle to MenuFile_3 (see GCBO)</span>
19491885 <span class="comment">% eventdata  reserved - to be defined in a future version of MATLAB</span>
19501886 <span class="comment">% handles    structure with handles and user data (see GUIDATA)</span>
19511887
19521888
19531889 <span class="comment">% --------------------------------------------------------------------</span>
19541890 <a name="_sub40" href="#_subfunctions" class="code">function MenuFile_4_Callback(hObject, eventdata, handles)</a>
19551891 <span class="comment">% hObject    handle to MenuFile_4 (see GCBO)</span>
19561892 <span class="comment">% eventdata  reserved - to be defined in a future version of MATLAB</span>
19571893 <span class="comment">% handles    structure with handles and user data (see GUIDATA)</span>
19581894
19591895
19601896 <span class="comment">% --------------------------------------------------------------------</span>
19611897 <a name="_sub41" href="#_subfunctions" class="code">function MenuFile_5_Callback(hObject, eventdata, handles)</a>
19621898 <span class="comment">% hObject    handle to MenuFile_5 (see GCBO)</span>
19631899 <span class="comment">% eventdata  reserved - to be defined in a future version of MATLAB</span>
19641900 <span class="comment">% handles    structure with handles and user data (see GUIDATA)</span>
19651901
19661902
19671903 <span class="comment">% --------------------------------------------------------------------</span>
19681904 <a name="_sub42" href="#_subfunctions" class="code">function ExportField_Callback(hObject, eventdata, handles)</a>
19691905 <span class="comment">% hObject    handle to ExportField (see GCBO)</span>
19701906 <span class="comment">% eventdata  reserved - to be defined in a future version of MATLAB</span>
19711907 <span class="comment">% handles    structure with handles and user data (see GUIDATA)</span>
19721908
19731909</pre></div>
1974<hr><address>Generated on Fri 13-Nov-2009 11:17:03 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> &copy; 2003</address>
1975</body>
1976</html>
Note: See TracBrowser for help on using the repository browser.