Size mismatch error using Matlab function to solve equations
Mostrar comentarios más antiguos
Hi All,
Im trying to use matlab function in simulink using the following code:
- function S= fcn (A,B,C,D,E)
- R=roots([A B C D E]); %ABCDE are coefficients of a polynomial that i want to solve and are preovided as real constants
- k=(zeros(1,4));
- k=R(imag®==0);% to discard the complex roots. this is my requirement
- k=real(k);
- S=zeros(1,4);
- S(:)=k;
The size of S is specified as [1,4] in the model explorer. I have to use fixed size calculations. When I run this code, I get a runtime error, "simulation stopped due to size mismatch error 4~=0." When I stop the debugger, the function block gets highlighted and I get the following error,: MATLAB Function Interface Error: Unknown MATLAB error encountered. Block Equation (#1512) While executing: none
Can somebody help me plese? Thanks in advance
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Simulink Coder en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!