MATLAB: How to search a word both uppercase and lowercase given a specified string

caselowercaseMATLAB and Simulink Student Suiteregexpsearchuppercase

MIM Maestro puts volume data inside the table variable names:
Rectum (4)(Volume: 57.77) Bladder (5)(Volume: 139.40)
However, sometimes the name is lowercase, e.g. 'bladder'. If one wishes to pull the volume '139.40' from the CSV file, how can one search for both 'Bladder' and 'bladder' in a single query given an input string?
The following function only searches the entered string with regexp; if the input organ string is 'Bladder', doesn't regexp neglect 'bladder'?
function output = GetVolumesFromDVH(organ)
[omitting code to loop through multiple files...]
searchstring = [organ,'_'];
[...]
output(fileloop) = GetOrgVol(filepath,searchstring);
[...]
end
function volume = GetOrgVol(filepath,searchstring)
% get list of variable names
opts = detectImportOptions(filepath, 'NumHeaderLines', 1);
% we find the column containing the organ volume
OrganSearching = regexp(opts.VariableNames,searchstring);
for loop = 1:numel(opts.VariableNames)
if OrganSearching{loop} == 1
index = loop;
end
end
% extract volume from said string
volume = extractAfter(opts.VariableNames{index},'Volume_');
volume = sscanf(strrep(volume,'_','.'),'%f');
end

Best Answer

The regexpi (link) function is the case-insensitive version of regexp.