【发布时间】:2013-11-10 03:46:30
【问题描述】:
我在 matlab/octave 中有三个独立的数组,它们都相互关联。
我正在尝试根据 c 的排序对 a 和 b 的数组值进行排序(因此当 c 排序时,a 和 b 数组的排序顺序与 c 数组相同)。
Example:
Original Array
a= [1.2 2 3 4 5 6]
b= [3 5 6 4.1 7 9]
c= [2.2 1 9 6 8 3]
数组 a 和 b 基于 c 的排序 (注意所有的数组都是按照 Array c 的排序顺序来排序的)
Final Array that I want:
a= [2 1.2 6 4 5 3]
b= [5 3 9 4.1 7 6]
c= [1 2.2 3 6 8 9]
阿罗哈 瑞克
PS:我正在使用 matlab/octave 如果有更好的方法请告诉我
【问题讨论】:
-
MATLAB - Sort a matrix based off how a vector is sorted 的可能重复项 ... 这个答案也是重复项。这些问题已经出现了很多时间,只需搜索“vector”而不是“array”
-
简短回答:从
sort和apply them to the other arrays 获取排序索引或将向量作为矩阵的列和usesortrows
标签: arrays matlab sorting multidimensional-array octave