# HG changeset patch # User Philip Nienhuis # Date 1350854311 -7200 # Node ID e21b21c2a20d15263cf705466220399acb69ddde # Parent 1f90fc84065a9c3b2a87b2add59b61161a3795dd importdata.m: properly fall back to unimplemented.m & allow spreadheet I/O diff --git a/scripts/io/importdata.m b/scripts/io/importdata.m --- a/scripts/io/importdata.m +++ b/scripts/io/importdata.m @@ -50,6 +50,8 @@ ## ## @item @sc{Matlab} file ## +## @item Spreadsheet files (depending on external software) +## ## @item Wav file ## ## @end itemize @@ -135,13 +137,17 @@ delimiter = NaN; header_rows = 0; output = load (fname); - case ".wk1" - error (sprintf ("importdata: not implemented for file format %s", - fileExt)); - case {".xls", ".xlsx"} - ## FIXME: implement Excel import. - error (sprintf ("importdata: not implemented for file format %s", - fileExt)); + case {".wk1", ".xls", ".xlsx", ".dbf", ".pxl"} + ## If there's no Excel file support simply fall back to unimplemented.m + output = xlsread (fname); + case {".ods", ".sxc", ".fods", ".uos", ".xml"} + ## unimplemented.m only knows ML functions; odsread isn't one but is in OF + try + output = odsread (fname); + catch + ## Fall back to unimplemented.m. + output = xlsread (fname); + end_try_catch case {".wav", ".wave"} delimiter = NaN; header_rows = 0; @@ -266,7 +272,7 @@ for i=(header_rows+1):length(file_content_rows) ## Only use the row if it contains anything other than white-space ## characters. - if (length (regexp (file_content_rows{i}, "\S","match")) > 0) + if (length (regexp (file_content_rows{i}, "\\S","match")) > 0) row_data = regexp (file_content_rows{i}, delimiter_pattern, "split"); for j=1:length(row_data)