I am using symbolic toolbox to generate a matlab function. But the number of input to the generated function is varying with the number of objects that I need (e.g., number
You can create functions with variable numbers of input arguments with varargin.
function fun(varargin) a = cell2mat(varargin); % works only if arguments indeed only consists of scalars. % your code comes hereafter