I have the following code in an embedded matlab function in simulink:
function rad = fcn(lenkwinkel)
if lenkwinkel < 0
rad=[0 1 0 0];
elseif lenkwinkel > 0
rad=[1 0 0 0];
else
rad=[0 0 0 0];
end
In the simulation I have the "lenkwinkel" variable connected to the MATLAB Function Block,which is connected to a Mux block with 4 ports.
I am trying to use the function to send a vector with 4 binary elements to the Mux block, which then should split it into 4 signals. Unfortunately, this is not working. When I try to run this, I get:
Inferred size ('[1 4]') for data 'rad' (#44) does not match back propagated size ('[4]') from Simulink.
Can anyone help me with this? Thanks a lot.