comparison scripts/io/strread.m @ 19628:fe689210525c gui-release

maint: Periodic merge of stable to gui-release.
author John W. Eaton <jwe@octave.org>
date Tue, 20 Jan 2015 10:05:42 -0500
parents 589354cf668f 446c46af4b42
children 0e1f5a750d00
comparison
equal deleted inserted replaced
19624:6d75f1683ce8 19628:fe689210525c
159 ## depends on the last character of @var{str}: 159 ## depends on the last character of @var{str}:
160 ## 160 ##
161 ## @table @asis 161 ## @table @asis
162 ## @item last character = @qcode{"\n"} 162 ## @item last character = @qcode{"\n"}
163 ## Data columns are padded with empty fields or Nan so that all columns 163 ## Data columns are padded with empty fields or Nan so that all columns
164 ## have equal length 164 ## have equal length
165 ## 165 ##
166 ## @item last character is not @qcode{"\n"} 166 ## @item last character is not @qcode{"\n"}
167 ## Data columns are not padded; strread returns columns of unequal length 167 ## Data columns are not padded; strread returns columns of unequal length
168 ## 168 ##
169 ## @end table 169 ## @end table
175 175
176 ## Check input 176 ## Check input
177 if (nargin < 1) 177 if (nargin < 1)
178 print_usage (); 178 print_usage ();
179 endif 179 endif
180 180
181 if (isempty (str)) 181 if (isempty (str))
182 ## Return empty args (no match), rather than raising an error 182 ## Return empty args (no match), rather than raising an error
183 varargout = cell (1, nargout); 183 varargout = cell (1, nargout);
184 return; 184 return;
185 endif 185 endif
300 else 300 else
301 ## Determine the number of words per line as a first guess. Forms 301 ## Determine the number of words per line as a first guess. Forms
302 ## like %f<literal>) (w/o delimiter in between) are fixed further on 302 ## like %f<literal>) (w/o delimiter in between) are fixed further on
303 format = strrep (format, "%", " %"); 303 format = strrep (format, "%", " %");
304 fmt_words = regexp (format, '[^ ]+', "match"); 304 fmt_words = regexp (format, '[^ ]+', "match");
305 305
306 ## Find position of conversion specifiers (they start with %) 306 ## Find position of conversion specifiers (they start with %)
307 idy2 = find (! cellfun ("isempty", regexp (fmt_words, '^%'))); 307 idy2 = find (! cellfun ("isempty", regexp (fmt_words, '^%')));
308 308
309 ## Check for unsupported format specifiers 309 ## Check for unsupported format specifiers
310 errpat = '(\[.*\]|[cq]|[nfdu]8|[nfdu]16|[nfdu]32|[nfdu]64)'; 310 errpat = '(\[.*\]|[cq]|[nfdu]8|[nfdu]16|[nfdu]32|[nfdu]64)';