Mercurial > hg > octave-lyh
comparison scripts/plot/waitbar.m @ 14245:4506eade9f04
Use Matlab coding conventions for demos in plot/ directory.
* contrast.m, axis.m, clabel.m, colorbar.m, comet.m, contour.m, contour3.m,
cylinder.m, daspect.m, errorbar.m, ezplot.m, fplot.m, grid.m, hold.m,
isosurface.m, legend.m, loglog.m, loglogerr.m, pareto.m, patch.m, pbaspect.m,
pie.m, pie3.m, plot3.m, plotmatrix.m, plotyy.m, quiver.m, quiver3.m,
rectangle.m, refreshdata.m, scatter.m, scatter3.m, semilogx.m, semilogxerr.m,
semilogy.m, semilogyerr.m, shading.m, stem.m, subplot.m, text.m, title.m,
trimesh.m, triplot.m, trisurf.m, uigetdir.m, uigetfile.m, uimenu.m,
uiputfile.m, waitbar.m, xlim.m, ylim.m, zlim.m: Use Matlab coding conventions
for demos so that compare plots scripts will function.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sun, 22 Jan 2012 07:31:32 -0800 |
parents | 11949c9795a0 |
children | 27abe77158d6 |
comparison
equal
deleted
inserted
replaced
14241:a52925666288 | 14245:4506eade9f04 |
---|---|
90 set (p, "xdata", [0; frac; frac; 0]); | 90 set (p, "xdata", [0; frac; frac; 0]); |
91 ax = findobj (h, "type", "axes"); | 91 ax = findobj (h, "type", "axes"); |
92 if (ischar (msg) || iscellstr (msg)) | 92 if (ischar (msg) || iscellstr (msg)) |
93 th = get (ax, "title"); | 93 th = get (ax, "title"); |
94 curr_msg = get (th, "string"); | 94 curr_msg = get (th, "string"); |
95 ## graphics handles always store data as column vectors | |
96 if (iscellstr (msg)) | |
97 msg = msg(:); | |
98 endif | |
95 cmp = strcmp (msg, curr_msg); | 99 cmp = strcmp (msg, curr_msg); |
96 if (all (cmp(:))) | 100 if (! all (cmp(:))) |
97 set (th, "string", msg); | 101 set (th, "string", msg); |
98 endif | 102 endif |
99 endif | 103 endif |
100 else | 104 else |
101 h = __go_figure__ (NaN, "position", [250, 500, 400, 100], | 105 h = __go_figure__ (NaN, "position", [250, 500, 400, 100], |
130 | 134 |
131 endfunction | 135 endfunction |
132 | 136 |
133 | 137 |
134 %!demo | 138 %!demo |
135 %! h = waitbar (0, "0.00%"); | 139 %! h = waitbar (0, '0.00%'); |
136 %! for i = 0:0.01:1 | 140 %! for i = 0:0.01:1 |
137 %! waitbar (i, h, sprintf ("%.2f%%", 100*i)); | 141 %! waitbar (i, h, sprintf ('%.2f%%', 100*i)); |
138 %! endfor | 142 %! end |
139 %! close (h); | 143 %! close (h); |
140 | 144 |
141 %!demo | 145 %!demo |
142 %! h = waitbar (0, "please wait..."); | 146 %! h = waitbar (0, 'please wait...'); |
143 %! for i = 0:0.01:0.6 | 147 %! for i = 0:0.01:0.6 |
144 %! waitbar (i); | 148 %! waitbar (i); |
145 %! endfor | 149 %! end |
146 %! i = 0.3; | 150 %! i = 0.3; |
147 %! waitbar (i, h, "don't you hate taking a step backward?"); | 151 %! waitbar (i, h, 'don''t you hate taking a step backward?'); |
148 %! pause (0.5); | 152 %! pause (0.5); |
149 %! for i = i:0.005:0.7 | 153 %! for i = i:0.005:0.7 |
150 %! waitbar (i, h); | 154 %! waitbar (i, h); |
151 %! endfor | 155 %! end |
152 %! waitbar (i, h, "or stalling?"); | 156 %! waitbar (i, h, 'or stalling?'); |
153 %! pause (1); | 157 %! pause (1); |
154 %! for i = i:0.003:0.8 | 158 %! for i = i:0.003:0.8 |
155 %! waitbar (i, h, "just a little longer now"); | 159 %! waitbar (i, h, 'just a little longer now'); |
156 %! endfor | 160 %! end |
157 %! for i = i:0.001:1 | 161 %! for i = i:0.001:1 |
158 %! waitbar (i, h, "please don't be impatient"); | 162 %! waitbar (i, h, 'please don''t be impatient'); |
159 %! endfor | 163 %! end |
160 %! close (h); | 164 %! close (h); |
161 | 165 |
162 %!demo | 166 %!demo |
163 %! h1 = waitbar (0, "Waitbar #1"); | 167 %! h1 = waitbar (0, 'Waitbar #1'); |
164 %! h2 = waitbar (0, "Waitbar #2"); | 168 %! h2 = waitbar (0, 'Waitbar #2'); |
165 %! h2pos = get (h2, "position"); | 169 %! h2pos = get (h2, 'position'); |
166 %! h2pos(1) += (h2pos(3) + 50); | 170 %! h2pos(1) += (h2pos(3) + 50); |
167 %! set (h2, "position", h2pos); | 171 %! set (h2, 'position', h2pos); |
168 %! pause (0.5); | 172 %! pause (0.5); |
169 %! for i = 1:4 | 173 %! for i = 1:4 |
170 %! waitbar (i/4, h1); | 174 %! waitbar (i/4, h1); |
171 %! pause (0.5); | 175 %! pause (0.5); |
172 %! waitbar (i/4, h2); | 176 %! waitbar (i/4, h2); |
173 %! pause (0.5); | 177 %! pause (0.5); |
174 %! endfor | 178 %! end |
175 %! pause (0.5); | 179 %! pause (0.5); |
176 %! close (h1); | 180 %! close (h1); |
177 %! close (h2); | 181 %! close (h2); |
178 | 182 |
179 %% Test input validation | 183 %% Test input validation |