diff scripts/io/strread.m @ 12940:3509cf60d1f6

strread.m: %Ns conversion format now honors user specified width (Bug #33950). * strread.m: Fix typo in code which fixed width at 3, regardless of user input.
author Philip Nienhuis <prnienhuis@@users.sf.net>
date Tue, 09 Aug 2011 07:42:10 -0700
parents cefd568ea073
children e81ddf9cacd5
line wrap: on
line diff
--- a/scripts/io/strread.m	Mon Aug 08 21:31:55 2011 -0700
+++ b/scripts/io/strread.m	Tue Aug 09 07:42:10 2011 -0700
@@ -471,7 +471,7 @@
         endif
       endfor
       ## Done
-      words_period = iwrd - 1;
+      words_period = max (iwrd - 1, 1);
       num_lines = ceil (num_words / words_period);
 
       ## 2. Pad words array so that it can be reshaped
@@ -633,7 +633,7 @@
               if (pad_out)
                 data(end+1:num_lines) = {""}
               endif
-              varargout{k} = strtrunc (data, 3)';
+              varargout{k} = strtrunc (data, swidth)';
               k++;
             otherwise
           endswitch