I am confused with scalars!!!
Show older comments
if mi(:)>(a1(:)+n(:)) && mi(:)<(a1(:)-n(:)) && (ma(:)>(b1(:)+n(:)) && ma<(b1(:)-n(:))
boxing_out=all(1);
else if mi(:)>(a2(:)+n(:))&&mi(:)<(a2(:)-n(:))&&ma(:)>(b2(:)+n(:))&&ma(:)<(b2(:)-n(:))
boxing_out(:)=2;
else if mi(:)>(a3(:)+n(:))&&mi(:)<(a3(:)-n(:))&&ma(:)>(b3(:)+n(:))&&ma(:)<(b3(:)-n(:))
boxing_out(:)=3;
else if mi>(a4+n)&&mi<(a4-n)&&ma>(b4+n)&&ma<(b4-n)
boxing_out(:)=4;
else if mi>(a5+n)&&mi<(a5-n)&&ma>(b5+n)&&ma<(b5-n)
boxing_out(:)=5;
else
boxing_out(:)=0;
end
end
end
end
end
I write this but I get the follow error. Expected a scalar. Non-scalars are not supported in IF or WHILE statements, or with logical operators. Instead, use ALL to convert matrix logicals to their scalar equivalents. I don't how to solve this question.Who can help me .
[EDITED, Jan, please format your code]
Accepted Answer
More Answers (0)
Categories
Find more on Speed and Area Optimization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!