How can I use the output of intersect function in my simulink block?

1 view (last 30 days)
I have a Matlab function block that contains the following code:
function b = fcn(b1, b2)
coder.extrinsic('polyshape');
p1 = polyshape([b1(1) b1(2);b1(3) b1(4);b1(5) b1(6);b1(7) b1(8)]);
p2 = polyshape([b2(1) b2(2);b2(3) b2(4);b2(5) b2(6);b2(7) b2(8)]);
p3 = intersect(p1, p2);
b = p3.NumRegions;
end
I get the error (Attempt to extract field 'NumRegions' from 'mxArray'). How can I get the value of this field?

Accepted Answer

Beshoy Saad
Beshoy Saad on 20 May 2018
I created a separate .m file containing this code and called it extrinsically from here.

More Answers (0)

Categories

Find more on Large-Scale Modeling in Help Center and File Exchange

Tags

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!