Create a matrix from another matrix

1 次查看(过去 30 天)
I have a matrix A=[ 5 6 4; 1 2 8; 9 7 11] and two arrays that have the coordinates x,y of every variable of the matrix A.I want to create two matrixes.The first one will have instead the variables of matrix A,the x coordinate and the other one matrix the y.For example the matrix X will have X=[x(5) x(6) x(4); x(1) x(2) x(8); x(9) x(7) x(11)]. Can i do it with one command.At my problems i have much bigger matrixes and i cant write it one by one.

采纳的回答

Titus Edelhofer
Titus Edelhofer 2015-5-4
Hi Giannakis,
I guess just by using A as index:
A=[ 5 6 4; 1 2 8; 9 7 11];
x = 1:2:21
x =
1 3 5 7 9 11 13 15 17 19 21
x(A)
ans =
9 11 7
1 3 15
17 13 21
Titus

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by