How to convert mxarray datatype in simulink
显示 更早的评论
I have to remove small objects from binary image and Im trying to use bwareaopen in simulink by using following code:
function y = fcn(u)
x = zeros(size(u));
coder.extrinsic('bwareaopen');
x = bwareaopen(u, 50);
y = double(x);
and getting error:
Class mismatch for variable 'bwareaopen'. Expected 'double', Actual 'logical'. Block MATLAB Function (#24) While executing: none
Model is as follows:

%
采纳的回答
更多回答(1 个)
Kaustubha Govind
2014-3-20
It looks like bwareaopen returns an output of type logical. You need to pre-declare 'x' as follows:
x = zeros(size(u), 'logical');
1 个评论
Nazim Badar
2014-3-22
编辑:Nazim Badar
2014-3-22
类别
在 帮助中心 和 File Exchange 中查找有关 Computer Vision with Simulink 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
