Skip to content
Snippets Groups Projects
Commit 3afbf5e2 authored by leprob001's avatar leprob001
Browse files

Bugfix, the determineParseType function returned the wrong type if the first...

Bugfix, the determineParseType function returned the wrong type if the first line in the section is a comment.
parent c4d76119
Branches
Tags
No related merge requests found
......@@ -98,8 +98,14 @@ end
function [ type ] = determineParseType(pContent)
lines = splitlines(pContent);
lineToCheck = 1;
lineCheck = strtrim(lines{lineToCheck});
while (lineCheck(1) == reservedCharacters.comment)
lineToCheck = lineToCheck + 1;
lineCheck = strtrim(lines{lineToCheck});
end
% check if everything can be parsed as number
tmpRow = strsplit(lines{1}, {'\t', ' '}, 'CollapseDelimiter', true);
tmpRow = strsplit(lines{lineToCheck}, {'\t', ' '}, 'CollapseDelimiter', true);
tmpRow = tmpRow(~cellfun('isempty', tmpRow));
nanInRow = contains(tmpRow, 'NaN');
rowAsNumber = str2double(tmpRow);
......@@ -111,8 +117,8 @@ end
% it cannot be parsed as matrix, so check if it can be parsed as
% struct
hasVariableIndicator = ...
(lines{1}(1) == reservedCharacters.variableIndicator);
alphabeticLetters = isletter(lines{1});
(lines{lineToCheck}(1) == reservedCharacters.variableIndicator);
alphabeticLetters = isletter(lines{lineToCheck});
if hasVariableIndicator && alphabeticLetters(2)
type = 'struct';
......
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment