access the multidimensional data using linear index
显示 更早的评论
i need to calculate the distance by using the route for travelling saleman problem. im having my distance value in one matrix 'DIST' and route is in another matrix 'path'
it is an 5 cities tsp problem.
DIST = [ 0 2 5 8 3
.............
............
7 6 3 4 0] it is a 5 x 5 matrix
path =[ 1 2 3 4 5
1 2 3 5 4
.......
.......
5 4 3 2 1] it is a 120 x 5 matrix
for each row of path get the value from DIST [eg:1 2 in path it will get the value 2 from the DIST]
kindly hlep me code this.....
2 个评论
madhan ravi
2019-1-28
编辑:madhan ravi
2019-1-28
Can you give an explicit example of your desired output?
praveensilvi
2019-1-28
回答(2 个)
Walter Roberson
2019-1-28
0 个投票
multidimensional indexing is not needed . Only 2d.
类别
在 帮助中心 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!