Skip to content
Snippets Groups Projects
Commit edd66d6b authored by jacques.grelet_ird.fr's avatar jacques.grelet_ird.fr
Browse files

check if we are is the right paragraph context for global attributes

parent 9df3a458
No related branches found
No related tags found
No related merge requests found
...@@ -49,30 +49,38 @@ while ~feof(fid) ...@@ -49,30 +49,38 @@ while ~feof(fid)
context = match{1}{1}; context = match{1}{1};
end end
% Iterate from each element from object nca and additional variables % check if we are is the right paragraph context
% ------------------------------------------------------------------ % ----------------------------------------------
for ii = nca_keys if strcmp(context, 'GLOBAL') || strcmp(context, 'GENERAL') || ...
strcmp(context, tsg.TYPE_TSG) || strcmp(context, tsg.TYPE_TINT)
% get key, use char because i is cell
% -----------------------------------
clef = char(ii);
% construct regex with pair cle=value
% and extract value
% ------------------------------------
regex = strcat('^\s*', clef, '\s*=\s*(.+)$');
match = regexp( str, regex, 'tokens');
% build tsg struct % Iterate from each element from object nca and additional variables
% ---------------- % ------------------------------------------------------------------
if ~isempty(match) for ii = nca_keys
%if isnan(str2double(match{1}{1}))
tsg.(clef) = match{1}{1}; % get key, use char because i is cell
%else % -----------------------------------
% tsg.(clef) = sprintf('%f',str2double(match{1}{1})); clef = char(ii);
%end
continue % construct regex with pair cle=value
% and extract value
% ------------------------------------
regex = strcat('^\s*', clef, '\s*=\s*(.+)$');
match = regexp( str, regex, 'tokens');
% build tsg struct
% ----------------
if ~isempty(match)
%if isnan(str2double(match{1}{1}))
tsg.(clef) = match{1}{1};
%else
% tsg.(clef) = sprintf('%f',str2double(match{1}{1}));
%end
continue
end
end end
end end
% check if we are is the right paragraph context % check if we are is the right paragraph context
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment