changeset 19041:d69358d7f9bb

textscan.m: Avoid conjugate transpose for complex data and empty format string (bug #42528)
author Philip Nienhuis <prnienhuis@users.sf.net>
date Fri, 04 Jul 2014 14:53:58 +0200
parents 96751a74bbbb
children c3af040956df
files scripts/io/textscan.m
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/io/textscan.m	Tue Aug 12 15:27:16 2014 -0400
+++ b/scripts/io/textscan.m	Fri Jul 04 14:53:58 2014 +0200
@@ -329,7 +329,7 @@
       ## Compute nr. of rows
       nrows = floor (numel (C{1}) / ncols);
       ## Reshape C; watch out, transpose needed
-      C(1) = reshape (C{1}, ncols, numel (C{1}) / ncols)';
+      C(1) = reshape (C{1}, ncols, numel (C{1}) / ncols).';
       ## Distribute columns over C and wipe cols 2:end of C{1}
       for ii=2:ncols
         C(ii) = C{1}(:, ii);
@@ -677,3 +677,7 @@
 %! a = textscan (",1,,4\nInf,  ,NaN", "", "delimiter", ",", "emptyvalue", -10);
 %! assert (cell2mat (a), [-10, 1, -10, 4; Inf, -10, NaN, -10]);
 
+%% Bug #42528
+%!test
+%! assert (textscan ("1i", ""){1},  0+1i);
+%! assert (cell2mat (textscan ("3, 2-4i, NaN\n -i, 1, 23.4+2.2i", "")), [3+0i, 2-4i, NaN+0i; 0-i,  1+0i, 23.4+2.2i]);