Size mismatch error using regionprops in Simulink matlab function block

7 ビュー (過去 30 日間)
Andrew Poissant
Andrew Poissant 2018 年 7 月 10 日
編集済み: Andrew Poissant 2018 年 7 月 10 日
I am trying to use matlab's regionprop function in a matlab function block in Simulink. In the function block, I have a 47 x 52 binary image (BW) and I want to use regionprops to extract various properties. Below is my code to extract the centroids of the binary image. When I run the simulink model I get the following error:
"Size mismatch for MATLAB expression 'regionprops'. Expected = 1x1 Actual = 7x1"
I suspect this is because I have 7 different centroids, but I am unsure of how to get around this error.
coder.extrinsic('regionprops')
s_centroid = struct('centroid', zeros(2,1));
s_centroid = regionprops(BW, 'centroid');
centroid = s_centroid.centroid

回答 (0 件)

カテゴリ

Help Center および File ExchangeModeling についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by