Not a full answer, but I developed a workaround which adds the requisite variables to the base workspace then deletes them after publishing.
Requires:
- putvar(), on the FEX, from John d'Ericco (John saves me yet again!)
- care that this doesn't overwrite then delete similarly named variables in that workspace.
options.codeToEvaluate = 'myReportingFcn(a)';
putvar(a)
publish('trainFoilReport.m',options)
evalin('base','clearvars a')