I am confused with scalars!!!
Ältere Kommentare anzeigen
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]
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Speed and Area Optimization finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!