From: <cde...@us...> - 2010-09-30 11:02:00
|
Revision: 7783 http://octave.svn.sourceforge.net/octave/?rev=7783&view=rev Author: cdemills Date: 2010-09-30 11:01:54 +0000 (Thu, 30 Sep 2010) Log Message: ----------- - re-added the stripping of fields initial spaces, which was de-activated by the switch from regexp -> strsplit 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 10:11:30 UTC (rev 7782) +++ trunk/octave-forge/extra/dataframe/inst/@dataframe/dataframe.m 2010-09-30 11:01:54 UTC (rev 7783) @@ -157,8 +157,9 @@ end_unwind_protect lines = regexp(in,'(^|\n)([^\n]+)', 'match'); %# cut into lines lines = cellfun(@(x) regexp(x, '[^\n]*', 'match'), lines); + %# remove \n %#, \'UniformOutput', false); - %# remove \n + %# a field either starts at a word boundary, either by + - . for %# a numeric data, either by ' for a string. @@ -167,7 +168,7 @@ content = cellfun(@(x) strsplit(x, sep), lines, \ 'UniformOutput', false); %# extract fields - indl = 1; indj = 1; %#disp('line 151 '); keyboard + indl = 1; indj = 1; %# disp('line 151 '); keyboard if ~isempty(seeked), while indl <= length(lines), dummy = content{indl}; @@ -176,8 +177,8 @@ endif indl = indl + 1; endwhile - else - dummy = content{indl}; + %# else + %# dummy = content{indl}; endif x = cell(1+length(lines)-indl, size(dummy, 2)); empty_lines = []; @@ -188,6 +189,8 @@ 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, ... 'UniformOutput', false); @@ -219,7 +222,7 @@ x(empty_lines, :) = []; endif %# detect empty columns - empty_lines = find(0 == sum(cellfun('size', x, 2))) + empty_lines = find(0 == sum(cellfun('size', x, 2))); if !isempty(empty_lines), x(:, empty_lines) = []; endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |