[37] | 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 ListDir</title> |
---|
| 6 | <meta name="keywords" content="ListDir"> |
---|
| 7 | <meta name="description" content="'ListDir': scan the structure of the directory tree (for dataview.m)"> |
---|
| 8 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
| 9 | <meta name="generator" content="m2html © 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> > <a href="index.html">.</a> > ListDir.m</div> |
---|
| 16 | |
---|
| 17 | <!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png"> Master index</a></td> |
---|
| 18 | <td align="right"><a href="index.html">Index for . <img alt=">" border="0" src="../right.png"></a></td></tr></table>--> |
---|
| 19 | |
---|
| 20 | <h1>ListDir |
---|
| 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>'ListDir': scan the structure of the directory tree (for dataview.m)</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 [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices_in,ListRecords_in) </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">'ListDir': scan the structure of the directory tree (for dataview.m) |
---|
| 31 | ------------------------------------------------------------------------</pre></div> |
---|
| 32 | |
---|
| 33 | <!-- crossreference --> |
---|
| 34 | <h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
| 35 | This function calls: |
---|
| 36 | <ul style="list-style-image:url(../matlabicon.gif)"> |
---|
| 37 | </ul> |
---|
| 38 | This function is called by: |
---|
| 39 | <ul style="list-style-image:url(../matlabicon.gif)"> |
---|
| 40 | <li><a href="dataview.html" class="code" title="function varargout = dataview(varargin)">dataview</a> TEST 'dataview': function for scanning directories in a campaign (TEST)</li><li><a href="editxml.html" class="code" title="function varargout = editxml(varargin)">editxml</a> 'editxml': function for editing xml files using a xml schema (associated with the GUI editxml.fig)</li><li><a href="geometry_calib.html" class="code" title="function varargout = geometry_calib(varargin)">geometry_calib</a> 'geometry_calib': performs geometric calibration from a set of reference points</li></ul> |
---|
| 41 | <!-- crossreference --> |
---|
| 42 | |
---|
| 43 | <h2><a name="_subfunctions"></a>SUBFUNCTIONS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
| 44 | <ul style="list-style-image:url(../matlabicon.gif)"> |
---|
| 45 | <li><a href="#_sub1" class="code">function [testnew,testselect]=test_select(name,ListDevices,ListDevices_in)</a></li></ul> |
---|
| 46 | <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
| 47 | <div class="fragment"><pre>0001 <span class="comment">%'ListDir': scan the structure of the directory tree (for dataview.m)</span> |
---|
| 48 | 0002 <span class="comment">%------------------------------------------------------------------------</span> |
---|
| 49 | 0003 <a name="_sub0" href="#_subfunctions" class="code">function [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices_in,ListRecords_in)</a> |
---|
| 50 | 0004 |
---|
| 51 | 0005 ListRecords={}; |
---|
| 52 | 0006 ListDevices={}; |
---|
| 53 | 0007 ListXml={}; |
---|
| 54 | 0008 irecord_tot=0; |
---|
| 55 | 0009 idevice_tot=0; |
---|
| 56 | 0010 ixml_tot=0; |
---|
| 57 | 0011 <span class="keyword">for</span> iexp=1:length(ListExperiments) |
---|
| 58 | 0012 List.Experiment{iexp}.name=ListExperiments{iexp}; |
---|
| 59 | 0013 hdir=dir(fullfile(CurrentPath,ListExperiments{iexp})); |
---|
| 60 | 0014 idevice=0; |
---|
| 61 | 0015 <span class="keyword">for</span> isub=1:length(hdir)<span class="comment">% scan the sub-directories of the current experiment</span> |
---|
| 62 | 0016 <span class="keyword">if</span> hdir(isub).isdir |
---|
| 63 | 0017 name=hdir(isub).name;<span class="comment">%name of the current device</span> |
---|
| 64 | 0018 <span class="keyword">if</span> ~isequal(name(1),<span class="string">'.'</span>)<span class="comment">% subdirectory of the current experiment</span> |
---|
| 65 | 0019 [testnew,testselect]=<a href="#_sub1" class="code" title="subfunction [testnew,testselect]=test_select(name,ListDevices,ListDevices_in)">test_select</a>(name,ListDevices,ListDevices_in); |
---|
| 66 | 0020 <span class="keyword">if</span> testselect |
---|
| 67 | 0021 idevice=idevice+1; |
---|
| 68 | 0022 List.Experiment{iexp}.Device{idevice}.name=name; |
---|
| 69 | 0023 <span class="keyword">if</span> testnew |
---|
| 70 | 0024 idevice_tot=idevice_tot+1; |
---|
| 71 | 0025 ListDevices{idevice_tot}=name; |
---|
| 72 | 0026 <span class="keyword">end</span> |
---|
| 73 | 0027 CurrentDevice=fullfile(CurrentPath,ListExperiments{iexp},name); |
---|
| 74 | 0028 hsubxml=dir(fullfile(CurrentDevice,<span class="string">'*.xml'</span>));<span class="comment">%look at xml files in the subdirectory of the current device</span> |
---|
| 75 | 0029 <span class="keyword">if</span> isempty(hsubxml) <span class="comment">% the subdirectory of the current device contains directories 'Record''</span> |
---|
| 76 | 0030 hsubdir=dir(fullfile(CurrentPath,ListExperiments{iexp},name));<span class="comment">%list what is inside the directory 'Device'</span> |
---|
| 77 | 0031 irecord=0; |
---|
| 78 | 0032 <span class="keyword">for</span> isubsub=1:length(hsubdir)<span class="comment">% subdirectories of the current device</span> |
---|
| 79 | 0033 <span class="keyword">if</span> hsubdir(isubsub).isdir |
---|
| 80 | 0034 RecordName=hsubdir(isubsub).name; |
---|
| 81 | 0035 <span class="keyword">if</span> ~isequal(RecordName(1),<span class="string">'.'</span>) |
---|
| 82 | 0036 [testnew,testselect]=<a href="#_sub1" class="code" title="subfunction [testnew,testselect]=test_select(name,ListDevices,ListDevices_in)">test_select</a>(RecordName,ListRecords,ListRecords_in); |
---|
| 83 | 0037 <span class="keyword">if</span> testselect |
---|
| 84 | 0038 <span class="keyword">if</span> testnew |
---|
| 85 | 0039 irecord_tot=irecord_tot+1; |
---|
| 86 | 0040 ListRecords{irecord_tot}=RecordName; |
---|
| 87 | 0041 <span class="keyword">end</span> |
---|
| 88 | 0042 irecord=irecord+1; |
---|
| 89 | 0043 List.Experiment{iexp}.Device{idevice}.Record{irecord}.name=RecordName; |
---|
| 90 | 0044 hsubsubxml=dir(fullfile(CurrentDevice,RecordName,<span class="string">'*.xml'</span>));<span class="comment">%</span> |
---|
| 91 | 0045 <span class="keyword">for</span> ixml=1:length(hsubsubxml) |
---|
| 92 | 0046 XmlName=hsubsubxml(ixml).name; |
---|
| 93 | 0047 List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml}=XmlName; |
---|
| 94 | 0048 testnew=<a href="#_sub1" class="code" title="subfunction [testnew,testselect]=test_select(name,ListDevices,ListDevices_in)">test_select</a>(XmlName,ListXml,{}); |
---|
| 95 | 0049 <span class="keyword">if</span> testnew |
---|
| 96 | 0050 ixml_tot=ixml_tot+1; |
---|
| 97 | 0051 ListXml{ixml_tot}=XmlName; |
---|
| 98 | 0052 <span class="keyword">end</span> |
---|
| 99 | 0053 <span class="keyword">end</span> |
---|
| 100 | 0054 <span class="keyword">end</span> |
---|
| 101 | 0055 <span class="keyword">end</span> |
---|
| 102 | 0056 <span class="keyword">end</span> |
---|
| 103 | 0057 <span class="keyword">end</span> |
---|
| 104 | 0058 <span class="keyword">else</span> |
---|
| 105 | 0059 <span class="keyword">for</span> ixml=1:length(hsubxml) |
---|
| 106 | 0060 XmlName=hsubxml(ixml).name; |
---|
| 107 | 0061 List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}=XmlName; |
---|
| 108 | 0062 testnew=<a href="#_sub1" class="code" title="subfunction [testnew,testselect]=test_select(name,ListDevices,ListDevices_in)">test_select</a>(XmlName,ListXml,{}); |
---|
| 109 | 0063 <span class="keyword">if</span> testnew |
---|
| 110 | 0064 ixml_tot=ixml_tot+1; |
---|
| 111 | 0065 ListXml{ixml_tot}=XmlName; |
---|
| 112 | 0066 <span class="keyword">end</span> |
---|
| 113 | 0067 <span class="keyword">end</span> |
---|
| 114 | 0068 <span class="keyword">end</span> |
---|
| 115 | 0069 <span class="keyword">end</span> |
---|
| 116 | 0070 <span class="keyword">end</span> |
---|
| 117 | 0071 <span class="keyword">end</span> |
---|
| 118 | 0072 <span class="keyword">end</span> |
---|
| 119 | 0073 <span class="keyword">end</span> |
---|
| 120 | 0074 |
---|
| 121 | 0075 <span class="comment">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%</span> |
---|
| 122 | 0076 <a name="_sub1" href="#_subfunctions" class="code">function [testnew,testselect]=test_select(name,ListDevices,ListDevices_in)</a> |
---|
| 123 | 0077 <span class="keyword">if</span> ~isempty(ListDevices_in) |
---|
| 124 | 0078 testnew=0; |
---|
| 125 | 0079 testselect=0; |
---|
| 126 | 0080 <span class="keyword">for</span> ilist=1:length(ListDevices_in) |
---|
| 127 | 0081 <span class="keyword">if</span> isequal(name,ListDevices_in{ilist}) |
---|
| 128 | 0082 testnew=1; |
---|
| 129 | 0083 testselect=1; |
---|
| 130 | 0084 <span class="keyword">break</span> |
---|
| 131 | 0085 <span class="keyword">end</span> |
---|
| 132 | 0086 <span class="keyword">end</span> |
---|
| 133 | 0087 <span class="keyword">else</span> |
---|
| 134 | 0088 testnew=1; |
---|
| 135 | 0089 testselect=1; |
---|
| 136 | 0090 <span class="keyword">end</span> |
---|
| 137 | 0091 <span class="keyword">if</span> testnew |
---|
| 138 | 0092 <span class="keyword">for</span> ilist=1:length(ListDevices) |
---|
| 139 | 0093 <span class="keyword">if</span> isequal(name,ListDevices{ilist}) |
---|
| 140 | 0094 testnew=0; |
---|
| 141 | 0095 <span class="keyword">break</span> |
---|
| 142 | 0096 <span class="keyword">end</span> |
---|
| 143 | 0097 <span class="keyword">end</span> |
---|
| 144 | 0098 <span class="keyword">end</span></pre></div> |
---|
| 145 | <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> © 2003</address> |
---|
| 146 | </body> |
---|
| 147 | </html> |
---|