I'm trying to create a MATLAB Function block with a variable-sized output in a Simulink model (R2014A and R2013B).
All that's in my Function block at the moment is the following:
function param_value = param_access(param_number)
param_value = zeros(size(param_number));
The input "param_number" is a variable-sized signal coming in from Simulink. Both the input and the output are marked as "Variable Sized" in the MATLAB Function Block Port manager. The input seems to be handled OK. However, the output signal is persistently retruning an error like "Output 'param_value' (#1128) has variable size but the upper bound is not specified; explicit upper bound must be provided."
As you can see, I believe that I have specified an upper bound through the coder.varsize function, but Simulink doesn't seem to be accepting it for some reason.
I'm also getting another error like "Error in port widths or dimensions. Output port 1 of 'untitled/MATLAB Function/param_number' is a one dimensional vector with a maximum of 2 elements." This one's a little funny because "param_number" is the input, not the output, so I think this is related to the hidden behind-the-scenes way the MATLAB Function block is implemented. This error always attaches itself to the last input of the MATLAB Function block, whatever that is, even if that signal itself is not actually variable-sized and just has a fixed size of [1 1].