Subscript indices must either be real positive integers or logicals.

2 ビュー (過去 30 日間)
Arundhatee Talukdar
Arundhatee Talukdar 2011 年 11 月 9 日
Hello all, this is my code
xyb= a two dimensional matrix storing x,y coordinates for some points
Y= meshgrid output
for i=1:30
dist=(xyb(2i,1)-xyb((2i-1),1))*(xyb(2i,2)-Y(10,1))/(xyb(2i,1)-xyb( (2i-1),1) )
end
But I am getting this error... can anyone please help

採用された回答

Walter Roberson
Walter Roberson 2011 年 11 月 9 日
2i is the way to encode complex(0,2), which is to say 0 + 2*sqrt(-1).
If you want to multiply your "i" variable by 2, use multiplication, 2*i
It is not recommended to use "i" as a variable name because of its existing use as the complex constant.

その他の回答 (1 件)

Arundhatee Talukdar
Arundhatee Talukdar 2011 年 11 月 10 日
Thank you so much.

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by