Skip to content

Commit

Permalink
Table/read.m: slightly re-organize code
Browse files Browse the repository at this point in the history
  • Loading branch information
dlegland committed Mar 30, 2021
1 parent f29364f commit 09ac3a6
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions matStats/@Table/read.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

% ------
% Author: David Legland
% e-mail: david.legland@inra.fr
% e-mail: david.legland@inrae.fr
% Created: 2010-08-05, using Matlab 7.9.0.529 (R2009b)
% Copyright 2010 INRA - Cepia Software Platform.

Expand All @@ -69,8 +69,22 @@
% parse options and group into data structure
options = parseOptions(varargin{:});

% additional processing of input options
if any(options.delim == options.whiteSpaces)
% if separator is space or tab, allow multiple separators to be treated
% as only one
delimOptions = {...
'Delimiter', options.delim, ...
'MultipleDelimsAsOne', true};
else
% otherwise, two separators correspond to distinct columns
delimOptions = {...
'Delimiter', options.delim, ...
'MultipleDelimsAsOne', false};
end


%% Open file
%% Open file for reading

[filePath, baseName, ext] = fileparts(fileName);

Expand Down Expand Up @@ -101,19 +115,6 @@
% keep filename into data structure
[path, name] = fileparts(fileName); %#ok<ASGLU>

if any(options.delim == options.whiteSpaces)
% if separator is space or tab, allow multiple separators to be treated
% as only one
delimOptions = {...
'Delimiter', options.delim, ...
'MultipleDelimsAsOne', true};
else
% otherwise, two separators correspond to distinct columns
delimOptions = {...
'Delimiter', options.delim, ...
'MultipleDelimsAsOne', false};
end


%% Read header

Expand Down

0 comments on commit 09ac3a6

Please sign in to comment.