swap elements in a matrix
显示 更早的评论
Hello i want to swap elements in a matrix.I want to do it to elements of the same row and to elements of differents rows. Please help.Thank you
2 个评论
Adam
2015-3-20
An example would be useful, although the usual method for swapping elements is to use a temporary variable to store one while you copy the other over the top of it and then copy from the temporary variable into the 2nd location.
Giannakis Stoukas
2015-3-20
编辑:the cyclist
2015-3-20
采纳的回答
更多回答(1 个)
Ahamed Tuani
2017-11-13
0 个投票
Hi,
I have been looking into local search as well. Giannakis, I know its quite q while ago but have you figure out how to do it?
The cyclist and fellow members, I have a question..say the path is 1-31-9-2-10-1..I want to swap 9 and 2 so that the new path will be 1-31-2-9-10-1. How can I do this? Tried indexing (maybe a dumb way) i.e init_tour((1:2):(4):(3):6) to get the new tour but its not working. Any help will be greatly appreciated. Thanks.
类别
在 帮助中心 和 File Exchange 中查找有关 Direct Search 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!