MATLAB: What is the error in the state space model

if statementinputmatlab functionoutputsimulink

Hi everyone, I have a state-space model here, which sent output u to MATLAB Function. Inside of MATLAB Function I declare Function [A,B,C,D] = input(u) and the if loop as the attached picture.
But when i run the simulation, It says invalid Matrix A in state space (I set A,B,C and D in each A,B,C,D block) Please tell me where is my mistake in my model/matlab function. Thank you in advance!!

Best Answer

The matrices A,B,C,D of your SS model should be set inside your SS block http://www.mathworks.com/help/simulink/slref/statespace.html#zmw57dd0e133327 , you can't set them as an entry of your system. The entries of your SS block are considered as the entry signals of your system.