MATLAB: How to use a loop for and plot

hold onloop forplot

Hey guys, I have the following command line. I want to draw the boundary borders of one object B. I for (i) running under the border B. But I do not know how correct?
[B,L] = bwboundaries(tumor,'Noholes');
hold on;
for i = 1:length(B)
plot(B(i)(:,2),B(i)(:,1),'y','Linewith',1.45);
end
title('Detected Tumor');
hold off;

Best Answer

This addressing:
plot(B(i)(:,2),B(i)(:,1),'y','Linewith',1.45);
will throw an error. If ‘B’ is a cell array (as the documentation for bwboundaries says it is), use curly braces ‘{}’ as the first index reference:
plot(B{i}(:,2),B{i}(:,1),'y','LineWidth',1.45);
Spelling 'LineWidth' correctly will also be helpful.