Mercurial > hg > octave-nkf
diff scripts/strings/mat2str.m @ 19930:5f2c0ca0ef51
Ensure that numbers passed to integer *printf format codes are integers (bug #44245).
* num2str.m, validateattributes.m, inputname.m, stemleaf.m, print.m,
__ghostscript__.m, __gnuplot_print__.m, __go_draw_axes__.m,
__go_draw_figure__.m, bicg.m, qmr.m, mat2str.m, validatestring.m, assert.m:
Ensure that numbers passed to integer *printf format codes are integers.
author | Rik <rik@octave.org> |
---|---|
date | Mon, 16 Feb 2015 16:51:45 -0800 |
parents | 4197fc428c7d |
children | 9fc020886ae9 |
line wrap: on
line diff
--- a/scripts/strings/mat2str.m +++ b/scripts/strings/mat2str.m @@ -70,6 +70,10 @@ n = 15; elseif (isempty (n)) n = 15; # Default precision + elseif (numel (n) > 2) + error ("mat2str: N must have only 1 or 2 elements"); + else + n = fix (n); endif x_islogical = islogical (x); @@ -144,4 +148,5 @@ %!error mat2str (1,2,3,4) %!error mat2str (["Hello"]) %!error <X must be two dimensional> mat2str (ones (3,3,2)) +%!error <N must have only 1 or 2 elements> mat2str (ones (3,3), [1 2 3])