Skip to content

Commit 09ac3a6

Browse files
committed
Table/read.m: slightly re-organize code
1 parent f29364f commit 09ac3a6

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

matStats/@Table/read.m

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

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

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

72+
% additional processing of input options
73+
if any(options.delim == options.whiteSpaces)
74+
% if separator is space or tab, allow multiple separators to be treated
75+
% as only one
76+
delimOptions = {...
77+
'Delimiter', options.delim, ...
78+
'MultipleDelimsAsOne', true};
79+
else
80+
% otherwise, two separators correspond to distinct columns
81+
delimOptions = {...
82+
'Delimiter', options.delim, ...
83+
'MultipleDelimsAsOne', false};
84+
end
85+
7286

73-
%% Open file
87+
%% Open file for reading
7488

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

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

104-
if any(options.delim == options.whiteSpaces)
105-
% if separator is space or tab, allow multiple separators to be treated
106-
% as only one
107-
delimOptions = {...
108-
'Delimiter', options.delim, ...
109-
'MultipleDelimsAsOne', true};
110-
else
111-
% otherwise, two separators correspond to distinct columns
112-
delimOptions = {...
113-
'Delimiter', options.delim, ...
114-
'MultipleDelimsAsOne', false};
115-
end
116-
117118

118119
%% Read header
119120

0 commit comments

Comments
 (0)