フィルターのクリア

Insert multiple vector into single data.

1 回表示 (過去 30 日間)
Asyran Abdullah
Asyran Abdullah 2018 年 10 月 3 日
コメント済み: KSSV 2018 年 10 月 3 日
Hi, i have some problem here, how can i add multiple data into "node(i).dist ". Here is the code.
for i = 1:1:numNodes
if node(i).tier == 1
node(i).dist = sqrt((node(i).x - baseStation.x).^2 + (node(i).y - baseStation.y).^2);
dist_tier1(i,1) = node(i).dist;
end
end
It contain error:
>> node(i).dist
Reference to non-existent field 'dist'.
The details:
sqrt((node(i).x - baseStation.x).^2 + (node(i).y - baseStation.y).^2)
ans =
Columns 1 through 7
39.293765408776999 37.696153649941529 26.925824035672520 47.169905660283021 47.169905660283021 25.495097567963924 43.011626335213137
Columns 8 through 10
47.423622805517503 39.000000000000000 43.011626335213137
baseStation.x = 50;
baseStation.y = 50;
numNodes = 100;
Hope someone can suggest/advice me how to solve this.
Thanks.
  2 件のコメント
madhan ravi
madhan ravi 2018 年 10 月 3 日
編集済み: madhan ravi 2018 年 10 月 3 日
Where is the data file/s??
KSSV
KSSV 2018 年 10 月 3 日
YOur node is a structure. The error clearly shows that node doesn't have the field dist.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by