Is there anybody to help me fix the error and convert mxArray to double?
27 views (last 30 days)
Show older comments
I am trying to implement the m-file into Matlab Function in Simulink. It needs to run some code conversion. Since "care()" function is not in the main library of this code converter, I have added coder.extrinsic('care'). Now when I run the Simulink it shows me the error as in the attached figure.
coder.extrinsic('care')
[~,~,G0] = care(hA, hB2, eye(4), eye(1), zeros(4,1), E);
KK=G0;
bA=hA-hB2*KK;
Now in my case bA(4x4 matrix), hB2(4x1 double), KK(1x4 mxArray). In fact after multiplication bA*hB2 should return 4x4 matrix. The problem is that KK should be double in order to work. How can I fix this issue of converting mxArray to double?
The code runs ok on m-file, but when I try to implement it on Simulink, it doesn't. I plan later to convert it to C++ code.
0 Comments
Accepted Answer
James Tursa
on 29 Aug 2017
What happens if you add this prior to the "care" call:
G0 = zeros(1,4);
2 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!