source: trunk/src/uvmat_doc/FUNCTIONS_DOC/plot_text.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: 9.8 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 plot_text</title>
6  <meta name="keywords" content="plot_text">
7  <meta name="description" content="'plot_text': function for displaying the content of a Matlab structure in a figure">
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; plot_text.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>plot_text
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>'plot_text': function for displaying the content of a Matlab structure in a figure</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 hdisplay=plot_text(FieldData,hdisplay_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">'plot_text': function for displaying the content of a Matlab structure in a figure
31------------------------------------------------------------------------
32 function hdisplay=plot_text(FieldData,hdisplay_in)
33
34 OUTPUT:
35 hdisplay: handle of the display edit box
36
37  INPUT:
38 FieldData: input Matlab structure
39 hdisplay_in: handles of the display box, if it is not defined create a new figure
40
41AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
42  Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org.
43AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
44     This file is part of the toolbox UVMAT.
45 
46     UVMAT is free software; you can redistribute it and/or modify
47     it under the terms of the GNU General Public License as published by
48     the Free Software Foundation; either version 2 of the License, or
49     (at your option) any later version.
50 
51     UVMAT is distributed in the hope that it will be useful,
52     but WITHOUT ANY WARRANTY; without even the implied warranty of
53     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
54     GNU General Public License (file UVMAT/COPYING.txt) for more details.
55AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</pre></div>
56
57<!-- crossreference -->
58<h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
59This function calls:
60<ul style="list-style-image:url(../matlabicon.gif)">
61<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></ul>
62This function is called by:
63<ul style="list-style-image:url(../matlabicon.gif)">
64<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></ul>
65<!-- crossreference -->
66
67
68<h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2>
69<div class="fragment"><pre>0001 <span class="comment">%'plot_text': function for displaying the content of a Matlab structure in a figure</span>
700002 <span class="comment">%------------------------------------------------------------------------</span>
710003 <span class="comment">% function hdisplay=plot_text(FieldData,hdisplay_in)</span>
720004 <span class="comment">%</span>
730005 <span class="comment">% OUTPUT:</span>
740006 <span class="comment">% hdisplay: handle of the display edit box</span>
750007 <span class="comment">%</span>
760008 <span class="comment">%  INPUT:</span>
770009 <span class="comment">% FieldData: input Matlab structure</span>
780010 <span class="comment">% hdisplay_in: handles of the display box, if it is not defined create a new figure</span>
790011 <span class="comment">%</span>
800012 <span class="comment">%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</span>
810013 <span class="comment">%  Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org.</span>
820014 <span class="comment">%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</span>
830015 <span class="comment">%     This file is part of the toolbox UVMAT.</span>
840016 <span class="comment">%</span>
850017 <span class="comment">%     UVMAT is free software; you can redistribute it and/or modify</span>
860018 <span class="comment">%     it under the terms of the GNU General Public License as published by</span>
870019 <span class="comment">%     the Free Software Foundation; either version 2 of the License, or</span>
880020 <span class="comment">%     (at your option) any later version.</span>
890021 <span class="comment">%</span>
900022 <span class="comment">%     UVMAT is distributed in the hope that it will be useful,</span>
910023 <span class="comment">%     but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
920024 <span class="comment">%     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
930025 <span class="comment">%     GNU General Public License (file UVMAT/COPYING.txt) for more details.</span>
940026 <span class="comment">%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</span>
950027
960028 <a name="_sub0" href="#_subfunctions" class="code">function hdisplay=plot_text(FieldData,hdisplay_in)</a>
970029
980030 <span class="keyword">if</span> exist(<span class="string">'hdisplay_in'</span>,<span class="string">'var'</span>) &amp; ishandle(hdisplay_in) &amp; isequal(get(hdisplay_in,<span class="string">'Type'</span>),<span class="string">'uicontrol'</span>)
990031     hdisplay=hdisplay_in;
1000032 <span class="keyword">else</span>
1010033     figure;<span class="comment">%create new figure</span>
1020034     hdisplay=uicontrol(<span class="string">'Style'</span>,<span class="string">'edit'</span>, <span class="string">'Units'</span>,<span class="string">'normalized'</span>,<span class="string">'Position'</span>, [0 0 1 1],<span class="string">'Max'</span>,2,<span class="string">'FontName'</span>,<span class="string">'monospaced'</span>);
1030035 <span class="keyword">end</span>
1040036     
1050037 ff=fields(FieldData);<span class="comment">%list of field names</span>
1060038 vv=struct2cell(FieldData);<span class="comment">%list of field values</span>
1070039
1080040 <span class="keyword">for</span> icell=1:length(vv)
1090041     Tabcell{icell,1}=ff{icell};
1100042     ss=vv{icell};
1110043     sizss=size(ss);
1120044     <span class="keyword">if</span> isnumeric(ss)
1130045         <span class="keyword">if</span> sizss(1)&lt;=1 &amp; length(ss)&lt;5
1140046             displ{icell}=num2str(ss);
1150047         <span class="keyword">else</span>
1160048             displ{icell}=[class(ss) <span class="string">', size '</span> num2str(size(ss))];
1170049         <span class="keyword">end</span>
1180050     <span class="keyword">elseif</span> ischar(ss)
1190051         displ{icell}=ss;
1200052     <span class="keyword">elseif</span> iscell(ss)
1210053         sizcell=size(ss);
1220054         <span class="keyword">if</span> sizcell(1)==1 &amp; length(sizcell)==2 <span class="comment">%line cell</span>
1230055            ssline=<span class="string">'{'''</span>;
1240056            <span class="keyword">for</span> icolumn=1:sizcell(2)
1250057                <span class="keyword">if</span> isnumeric(ss{icolumn})
1260058                    <span class="keyword">if</span> size(ss{icolumn},1)&lt;=1 &amp; length(ss{icolumn})&lt;5
1270059                       sscolumn=num2str(ss{icolumn});<span class="comment">%line vector</span>
1280060                    <span class="keyword">else</span>
1290061                       sscolumn=[class(ss{icolumn}) <span class="string">', size '</span> num2str(size(ss{icolumn}))];
1300062                    <span class="keyword">end</span>
1310063                <span class="keyword">elseif</span> ischar(ss{icolumn})
1320064                    sscolumn=ss{icolumn};
1330065                <span class="keyword">else</span>
1340066                    sscolumn=class(ss{icolumn});
1350067                <span class="keyword">end</span>
1360068                <span class="keyword">if</span> icolumn==1
1370069                    ssline=[ssline sscolumn];
1380070                <span class="keyword">else</span>
1390071                    ssline=[ssline <span class="string">''','''</span> sscolumn];
1400072                <span class="keyword">end</span>
1410073            <span class="keyword">end</span>
1420074            displ{icell}=[ssline <span class="string">'''}'</span>];
1430075         <span class="keyword">else</span>
1440076            displ{icell}=[class(ss) <span class="string">', size '</span> num2str(sizcell)];
1450077         <span class="keyword">end</span>
1460078     <span class="keyword">else</span>
1470079         displ{icell}=class(ss);
1480080     <span class="keyword">end</span>
1490081     Tabcell{icell,2}=displ{icell};
1500082 <span class="keyword">end</span> 
1510083 Tabchar=<a href="cell2tab.html" class="code" title="function Tabchar=cell2tab(Tabcell,separator)">cell2tab</a>(Tabcell,<span class="string">': '</span>);
1520084 set(hdisplay,<span class="string">'String'</span>, Tabchar)
1530085
1540086</pre></div>
155<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>
156</body>
157</html>
Note: See TracBrowser for help on using the repository browser.