Use object output from extrinsic functions within embedded matlab function in simulink

Hi, I am facing a problem similar to this Stackoverflow Question. I wish to use the MPT3 function "Polyhedron" within embedded matlab function. A minimal working example is below.
[A,b] = fcn(vertices)
% vertices is a n-times-2 matrix
coder.extrinsic('Polyhedron');
coder.varsize('A',[1024,2]);
coder.varsize('b',[1024 1]);
A = zeros(1024,2);
b = zeros(1024,1);
P = Polyhedron(vertices);
A = P.A;
b = P.b;
However, I get the error
  • Attempt to extract field 'A' from 'mxArray'.
  • Attempt to extract field 'b' from 'mxArray'.
when I try to compile my simulink model. How should I pre-initialise the object 'P'?
Thank you!...

Answers (0)

Categories

Find more on Simulation in Help Center and File Exchange

Products

Asked:

on 15 Apr 2018

Edited:

on 15 Apr 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!