diff --git a/tsg_io/readTsgIniLabview.m b/tsg_io/readTsgIniLabview.m index 36462453e88e04049d81ed84798cb2a9fa2a1cf7..251b82c6fb0e8d9a55fd16622b78e11a726e273b 100644 --- a/tsg_io/readTsgIniLabview.m +++ b/tsg_io/readTsgIniLabview.m @@ -49,30 +49,38 @@ while ~feof(fid) context = match{1}{1}; end - % Iterate from each element from object nca and additional variables - % ------------------------------------------------------------------ - for ii = nca_keys - - % 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'); + % check if we are is the right paragraph context + % ---------------------------------------------- + if strcmp(context, 'GLOBAL') || strcmp(context, 'GENERAL') || ... + strcmp(context, tsg.TYPE_TSG) || strcmp(context, tsg.TYPE_TINT) - % 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 + % Iterate from each element from object nca and additional variables + % ------------------------------------------------------------------ + for ii = nca_keys + + % 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 + % ---------------- + 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 % check if we are is the right paragraph context