MATLAB: How to parse and erase from a string while importing CSV with tableread

cellfundata tidyingextractbeforeimportMATLAB and Simulink Student Suiteparsestringtableread

I have found extractBefore, but how do I succinctly apply it to each opts.VariableNames element? Should I use cellfun? I will try it instead of a for loop, but I don't see how to use cellfun for a function requiring an input argument (namely, '_').
Why does MATLAB not allow for the following 'intuitive' syntax?
>> opts.VariableNames(:) = extractBefore(opts.VariableNames(:),'_')
Error using matlab.io.ImportOptions/set.VariableNames (line 185)
Expected a cell array of valid variable names.
>> opts.VariableNames = extractBefore(opts.VariableNames,'_')
Error using matlab.io.ImportOptions/set.VariableNames (line 185)
Expected a cell array of valid variable names.
The following code is what I am seeking to improve with this task, by automatically truncating the latter column names.
filepath = 'easy.csv';
opts = detectImportOptions(filepath, 'NumHeaderLines', 1);
opts = setvartype(opts,opts.VariableNames, 'double');
opts.VariableNames(1)={'Dose'};
DVH = readtable(filepath,opts)

Best Answer

The following code generates the table as desired.
function data = ReadMIMDVH(filepath)
opts = detectImportOptions(filepath, 'NumHeaderLines', 1);
opts = setvartype(opts,opts.VariableNames, 'double');
opts.VariableNames(1)={'Dose_'};
opts.VariableNames = extractBefore(opts.VariableNames,'_');
data = readtable(filepath,opts);
end
However, I hope someone will teach me how to accomplish this result in one line (via cellfun?) instead of four lines with a function.