I am new to Matlab and using the library code for A* algorithm. I am unable to understand the array notation in it. The code snippet is as given below. I am unable to identify that which element it is access with OPEN(1,1), please help me out.

2 ビュー (過去 30 日間)
OPEN[];
OPEN(1,:)=insert_open(xNode,yNode,xNode,yNode,path_cost,goal_distance,goal_distance);
OPEN(1,1)=0;
function new_row = insert_open(xval,yval,parent_xval,parent_yval,hn,gn,fn)
new_row=[1,8];
new_row(1,1)=1;
new_row(1,2)=xval;
new_row(1,3)=yval;
new_row(1,4)=parent_xval;
new_row(1,5)=parent_yval;
new_row(1,6)=hn;
new_row(1,7)=gn;
new_row(1,8)=fn;
end

回答 (2 件)

Sachin Ganjare
Sachin Ganjare 2013 年 1 月 24 日
insert_open function is returning a row of values.
OPEN(1,1) means 1st element of the row returned by insert_open function

Walter Roberson
Walter Roberson 2013 年 1 月 24 日
OPEN(1,1) would become new_row(1,1) which is set as 1.
More generally, OPEN(1,K) would become new_row(1,K) as set in the function.
Please re-check the first line. Is it really
OPEN=[];
instead of
OPEN[];
The version without the "=" would not be valid syntax.

カテゴリ

Help Center および File ExchangeData Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by