Mercurial > hg > octave-lyh
diff scripts/strings/strtrunc.m @ 13304:e1524d82f8e0
strtrunc.m: Fix errors in strread, textscan introduced by changeset 86d18a3cc911
* strtrunc.m: Fix errors in strread, textscan introduced by changeset 86d18a3cc911
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Sat, 08 Oct 2011 20:14:35 -0700 |
parents | b68b354a39c2 |
children | ad9b78544a22 |
line wrap: on
line diff
--- a/scripts/strings/strtrunc.m +++ b/scripts/strings/strtrunc.m @@ -38,7 +38,7 @@ ## Convoluted approach converts cellstr to char matrix, trims the character ## matrix using indexing, and then converts back to cellstr with mat2cell. ## This approach is 24X faster than using cellfun with call to strtrunc - idx = cellfun ("size", s, 2) > n; + idx = cellfun ("size", s, 2) >= n; rows = cellfun ("size", s(idx), 1); s(idx) = mat2cell (char (s(idx))(:, 1:n), rows); else