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 © 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> > plot_text.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>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 | |
---|
41 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
42 | Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org. |
---|
43 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
---|
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. |
---|
55 | AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</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> |
---|
59 | This 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> |
---|
62 | This 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> |
---|
70 | 0002 <span class="comment">%------------------------------------------------------------------------</span> |
---|
71 | 0003 <span class="comment">% function hdisplay=plot_text(FieldData,hdisplay_in)</span> |
---|
72 | 0004 <span class="comment">%</span> |
---|
73 | 0005 <span class="comment">% OUTPUT:</span> |
---|
74 | 0006 <span class="comment">% hdisplay: handle of the display edit box</span> |
---|
75 | 0007 <span class="comment">%</span> |
---|
76 | 0008 <span class="comment">% INPUT:</span> |
---|
77 | 0009 <span class="comment">% FieldData: input Matlab structure</span> |
---|
78 | 0010 <span class="comment">% hdisplay_in: handles of the display box, if it is not defined create a new figure</span> |
---|
79 | 0011 <span class="comment">%</span> |
---|
80 | 0012 <span class="comment">%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</span> |
---|
81 | 0013 <span class="comment">% Copyright Joel Sommeria, 2008, LEGI / CNRS-UJF-INPG, sommeria@coriolis-legi.org.</span> |
---|
82 | 0014 <span class="comment">%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</span> |
---|
83 | 0015 <span class="comment">% This file is part of the toolbox UVMAT.</span> |
---|
84 | 0016 <span class="comment">%</span> |
---|
85 | 0017 <span class="comment">% UVMAT is free software; you can redistribute it and/or modify</span> |
---|
86 | 0018 <span class="comment">% it under the terms of the GNU General Public License as published by</span> |
---|
87 | 0019 <span class="comment">% the Free Software Foundation; either version 2 of the License, or</span> |
---|
88 | 0020 <span class="comment">% (at your option) any later version.</span> |
---|
89 | 0021 <span class="comment">%</span> |
---|
90 | 0022 <span class="comment">% UVMAT is distributed in the hope that it will be useful,</span> |
---|
91 | 0023 <span class="comment">% but WITHOUT ANY WARRANTY; without even the implied warranty of</span> |
---|
92 | 0024 <span class="comment">% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span> |
---|
93 | 0025 <span class="comment">% GNU General Public License (file UVMAT/COPYING.txt) for more details.</span> |
---|
94 | 0026 <span class="comment">%AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</span> |
---|
95 | 0027 |
---|
96 | 0028 <a name="_sub0" href="#_subfunctions" class="code">function hdisplay=plot_text(FieldData,hdisplay_in)</a> |
---|
97 | 0029 |
---|
98 | 0030 <span class="keyword">if</span> exist(<span class="string">'hdisplay_in'</span>,<span class="string">'var'</span>) & ishandle(hdisplay_in) & isequal(get(hdisplay_in,<span class="string">'Type'</span>),<span class="string">'uicontrol'</span>) |
---|
99 | 0031 hdisplay=hdisplay_in; |
---|
100 | 0032 <span class="keyword">else</span> |
---|
101 | 0033 figure;<span class="comment">%create new figure</span> |
---|
102 | 0034 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>); |
---|
103 | 0035 <span class="keyword">end</span> |
---|
104 | 0036 |
---|
105 | 0037 ff=fields(FieldData);<span class="comment">%list of field names</span> |
---|
106 | 0038 vv=struct2cell(FieldData);<span class="comment">%list of field values</span> |
---|
107 | 0039 |
---|
108 | 0040 <span class="keyword">for</span> icell=1:length(vv) |
---|
109 | 0041 Tabcell{icell,1}=ff{icell}; |
---|
110 | 0042 ss=vv{icell}; |
---|
111 | 0043 sizss=size(ss); |
---|
112 | 0044 <span class="keyword">if</span> isnumeric(ss) |
---|
113 | 0045 <span class="keyword">if</span> sizss(1)<=1 & length(ss)<5 |
---|
114 | 0046 displ{icell}=num2str(ss); |
---|
115 | 0047 <span class="keyword">else</span> |
---|
116 | 0048 displ{icell}=[class(ss) <span class="string">', size '</span> num2str(size(ss))]; |
---|
117 | 0049 <span class="keyword">end</span> |
---|
118 | 0050 <span class="keyword">elseif</span> ischar(ss) |
---|
119 | 0051 displ{icell}=ss; |
---|
120 | 0052 <span class="keyword">elseif</span> iscell(ss) |
---|
121 | 0053 sizcell=size(ss); |
---|
122 | 0054 <span class="keyword">if</span> sizcell(1)==1 & length(sizcell)==2 <span class="comment">%line cell</span> |
---|
123 | 0055 ssline=<span class="string">'{'''</span>; |
---|
124 | 0056 <span class="keyword">for</span> icolumn=1:sizcell(2) |
---|
125 | 0057 <span class="keyword">if</span> isnumeric(ss{icolumn}) |
---|
126 | 0058 <span class="keyword">if</span> size(ss{icolumn},1)<=1 & length(ss{icolumn})<5 |
---|
127 | 0059 sscolumn=num2str(ss{icolumn});<span class="comment">%line vector</span> |
---|
128 | 0060 <span class="keyword">else</span> |
---|
129 | 0061 sscolumn=[class(ss{icolumn}) <span class="string">', size '</span> num2str(size(ss{icolumn}))]; |
---|
130 | 0062 <span class="keyword">end</span> |
---|
131 | 0063 <span class="keyword">elseif</span> ischar(ss{icolumn}) |
---|
132 | 0064 sscolumn=ss{icolumn}; |
---|
133 | 0065 <span class="keyword">else</span> |
---|
134 | 0066 sscolumn=class(ss{icolumn}); |
---|
135 | 0067 <span class="keyword">end</span> |
---|
136 | 0068 <span class="keyword">if</span> icolumn==1 |
---|
137 | 0069 ssline=[ssline sscolumn]; |
---|
138 | 0070 <span class="keyword">else</span> |
---|
139 | 0071 ssline=[ssline <span class="string">''','''</span> sscolumn]; |
---|
140 | 0072 <span class="keyword">end</span> |
---|
141 | 0073 <span class="keyword">end</span> |
---|
142 | 0074 displ{icell}=[ssline <span class="string">'''}'</span>]; |
---|
143 | 0075 <span class="keyword">else</span> |
---|
144 | 0076 displ{icell}=[class(ss) <span class="string">', size '</span> num2str(sizcell)]; |
---|
145 | 0077 <span class="keyword">end</span> |
---|
146 | 0078 <span class="keyword">else</span> |
---|
147 | 0079 displ{icell}=class(ss); |
---|
148 | 0080 <span class="keyword">end</span> |
---|
149 | 0081 Tabcell{icell,2}=displ{icell}; |
---|
150 | 0082 <span class="keyword">end</span> |
---|
151 | 0083 Tabchar=<a href="cell2tab.html" class="code" title="function Tabchar=cell2tab(Tabcell,separator)">cell2tab</a>(Tabcell,<span class="string">': '</span>); |
---|
152 | 0084 set(hdisplay,<span class="string">'String'</span>, Tabchar) |
---|
153 | 0085 |
---|
154 | 0086</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> © 2003</address> |
---|
156 | </body> |
---|
157 | </html> |
---|