# HG changeset patch # User Rik # Date 1317401830 25200 # Node ID b6efe55f97c710f1cbb4e0bec22ace255ef6bb86 # Parent be74491c20e804b6ea8478ba2989b622f039a007 Allow gtext() to have multi-line text strings (Bug #33232) * gtext.m: Simplify code to take advantage of cellstr handling already available in text(). diff -r be74491c20e8 -r b6efe55f97c7 scripts/plot/gtext.m --- a/scripts/plot/gtext.m Fri Sep 30 09:20:08 2011 -0700 +++ b/scripts/plot/gtext.m Fri Sep 30 09:57:10 2011 -0700 @@ -29,26 +29,19 @@ function gtext (s, varargin) - if (nargin > 0) - if (iscellstr (s)) - if (isempty (s)) - s = ""; - else - s = sprintf ("%s\n", s{:}); - endif - endif - if (ischar (s)) - if (! isempty (s)) - [x, y] = ginput (1); - text (x, y, s, varargin{:}); - endif - else - error ("gtext: expecting a string or cell array of strings"); - endif - else + if (nargin < 1) print_usage (); endif + if (! (ischar (s) || iscellstr (s))) + error ("gtext: S must be a string or cell array of strings"); + endif + + if (! isempty (s)) + [x, y] = ginput (1); + text (x, y, s, varargin{:}); + endif + endfunction ## Remove from test statistics. No real tests possible.