From: <cde...@us...> - 2010-10-01 07:09:10
|
Revision: 7787 http://octave.svn.sourceforge.net/octave/?rev=7787&view=rev Author: cdemills Date: 2010-10-01 07:09:03 +0000 (Fri, 01 Oct 2010) Log Message: ----------- - leading space(s) are now removed directly inside the regexp used to remove quotes Modified Paths: -------------- trunk/octave-forge/extra/dataframe/inst/@dataframe/dataframe.m Modified: trunk/octave-forge/extra/dataframe/inst/@dataframe/dataframe.m =================================================================== --- trunk/octave-forge/extra/dataframe/inst/@dataframe/dataframe.m 2010-09-30 20:20:14 UTC (rev 7786) +++ trunk/octave-forge/extra/dataframe/inst/@dataframe/dataframe.m 2010-10-01 07:09:03 UTC (rev 7787) @@ -195,20 +195,19 @@ indl = indl + 1; indj = indj + 1; continue; endif - %# remove leading space(s) - dummy = cellfun(@(x) regexp(x, '[^ ].*', 'match'), dummy); %# try to convert to float - the_line = cellfun(@(x) sscanf(x, "%f"), dummy, ... + the_line = cellfun(@(x) sscanf(x, "%f"), dummy, \ 'UniformOutput', false); for indk = 1: size(the_line, 2), if isempty(the_line{indk}) || any(size(the_line{indk}) > 1), - %#if indi > 1 && indk > 1, disp('line 117 '); keyboard; endif + %#if indi > 1 && indk > 1, disp('line 117 '); keyboard; %#endif if unquot, try - x(indj, indk) = regexp(dummy{indk}, '[^''].*[^'']', 'match'){1}; + %# remove quotes and leading space(s) + x(indj, indk) = regexp(dummy{indk}, '[^'' ].*[^'']', 'match'){1}; catch %# if the previous test fails, try a simpler one - in = regexp(dummy{indk}, '[^'']+', 'match'); + in = regexp(dummy{indk}, '[^'' ]+', 'match'); if !isempty(in), x(indj, indk) = in{1}; %# else @@ -216,7 +215,8 @@ endif end_try_catch else - x(indj, indk) = dummy{indk}; %# no conversion possible + %# no conversion possible, store and remove leading space(s) + x(indj, indk) = regexp(dummy{indk}, '[^ ].*', 'match'); endif else x(indj, indk) = the_line{indk}; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |