comparison scripts/strings/mat2str.m @ 19833:9fc020886ae9

maint: Clean up m-files to follow Octave coding conventions. Try to trim long lines to < 80 chars. Use '##' for single line comments. Use '(...)' around tests for if/elseif/switch/while. Abut cell indexing operator '{' next to variable. Abut array indexing operator '(' next to variable. Use space between negation operator '!' and following expression. Use two newlines between endfunction and start of %!test or %!demo code. Remove unnecessary parens grouping between short-circuit operators. Remove stray extra spaces (typos) between variables and assignment operators. Remove stray extra spaces from ends of lines.
author Rik <rik@octave.org>
date Mon, 23 Feb 2015 14:54:39 -0800
parents 5f2c0ca0ef51
children df437a52bcaf
comparison
equal deleted inserted replaced
19832:a1acca0c2216 19833:9fc020886ae9
141 %!assert (mat2str (int16 ([1 -1]), "class"), "int16([1 -1])") 141 %!assert (mat2str (int16 ([1 -1]), "class"), "int16([1 -1])")
142 %!assert (mat2str (true), "true") 142 %!assert (mat2str (true), "true")
143 %!assert (mat2str (false), "false") 143 %!assert (mat2str (false), "false")
144 %!assert (mat2str (logical (eye (2))), "[true false;false true]") 144 %!assert (mat2str (logical (eye (2))), "[true false;false true]")
145 145
146 %% Test input validation 146 ## Test input validation
147 %!error mat2str () 147 %!error mat2str ()
148 %!error mat2str (1,2,3,4) 148 %!error mat2str (1,2,3,4)
149 %!error mat2str (["Hello"]) 149 %!error mat2str (["Hello"])
150 %!error <X must be two dimensional> mat2str (ones (3,3,2)) 150 %!error <X must be two dimensional> mat2str (ones (3,3,2))
151 %!error <N must have only 1 or 2 elements> mat2str (ones (3,3), [1 2 3]) 151 %!error <N must have only 1 or 2 elements> mat2str (ones (3,3), [1 2 3])