Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions MATLAB2FAST/Matlab2FAST.m
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,15 @@ function Matlab2FAST(FastPar,TemplateFile,OutputFilename,hdrLines)
writeVal = getWriteVal( FastPar.Val{indx2} );

idx = strfind( line, label ); %let's just take the line starting where the label is first listed

% Use regex with word boundaries to find the label as an independent field, avoiding false matches inside quoted filenames
% If no match is found, keep the original idx from strfind as fallback.
regex_pattern = ['\<' regexptranslate('escape', label) '\>'];
regex_idx = regexp(line, regex_pattern, 'once');
if ~isempty(regex_idx)
idx = regex_idx;
end

line = [writeVal ' ' line(idx(1):end)];

else
Expand Down