vectorize for loop on plotting
古いコメントを表示
hi!
I would like to get some help to vectorize this 'for' loop:
for k = 1:length(tempStructs1{1,1})
sPoint_ePoint =[ tempStructs1{1,1}(k).point1 ; tempStructs1{1,1}(k).point2 ];
plot(sPoint_ePoint(:,1),sPoint_ePoint(:,2),'LineWidth',2,'Color','blue');
end
sPoint_ePoint is a column vector of 2 cells. Each cell contains one point. those 2 points represents a line that i want to plot.
I tried to vectorize the loop but i'm stuck... I can't make the program plot the lines appropriately, i think that happens because there is no 'k' (the looping variable) in this line of code:
plot(sPoint_ePoint(:,1),sPoint_ePoint(:,2),'LineWidth',2,'Color','blue');
and one more question: How can I know when the vectorized loop ends? there is no 'end' statement...
thanks!
1 件のコメント
Jan
2015 年 12 月 21 日
The question does not make sense. There is an end statement. In addition "vectorizing" and "loops" are complementary, so it is not meaningful to ask for the "end of the vectorized loop".
採用された回答
その他の回答 (1 件)
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!