I have been trying to clean some dust of my Simulink models shelves and encounter the following hurdle:
I'm using a Matlab function simulink block to output 2 scalar numbers vectIndx and tableNum. While trying to run the simulation (which run perfectly well with Matlab 2016B), I'm getting the follwing error:
'vectIndx' is inferred as a variable-size matrix, but its size is specified as inherited or fixed. Verify 'vectIndx' is defined in terms of non-tunable parameters, or select the 'Variable Size' check box and specify the upper bounds in the Size box. Component:MATLAB Function | Category:Coder error
I have tried to add
at the top of my funciton code but that didn't work either.
I have run the same block while disabling the function output variables via dubg mode and made sure these outputs holds scalar numbers.
Please see my code bellow:
function [vectIndx,tableNum] = fcn(mabc,Uabc,delt,vDrop,vectNum)
i = find(vectNum == [100 10 1]*mabc);
regMtrx = -1*Uabc(abs(vDrop(:,:,i))).*sign(vDrop(:,:,i)).*repmat(delt,size(vDrop,1),1);
[~, vectIndx] = max(sum(sign(regMtrx),2));
Cheers!
ML