Why can I not create a vector using this loop?

for i = 1:length(counties)
x(i).min = min(counties(i).Lon);
x(i).max = max(counties(i).Lon);
y(i).min = min(counties(i).Lat);
y(i).max = max(counties(i).Lat);
vector(i).x = x(i).min:x(i).max;
vector(i).y = y(i).min:y(i).max;
end
Here is what I get:

3 件のコメント

Kenneth Morley
Kenneth Morley 2014 年 1 月 24 日
The x.min, y.min, x.max and y.max all come out fine.
Matt J
Matt J 2014 年 1 月 24 日
編集済み: Matt J 2014 年 1 月 24 日
What's wrong with the result as you've shown it? What did you expect instead?
Image Analyst
Image Analyst 2014 年 1 月 25 日
編集済み: Image Analyst 2014 年 1 月 25 日
Isn't min(counties(i).Lon) the same as counties(i).Lon??? You are taking the min of only a single value. Or is the Lon field actually an array of several numbers?
What is counties(20).Lon, counties(20).Lat, and same for elements 1 and 24? They appear to be 2 element arrays, unlike the other elements. Why?

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

製品

タグ

質問済み:

2014 年 1 月 24 日

編集済み:

2014 年 1 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by