Create a matrix from another matrix
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Giannakis Stoukas
am 4 Mai 2015
Bearbeitet: Stephen23
am 4 Mai 2015
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.
0 Kommentare
Akzeptierte Antwort
Titus Edelhofer
am 4 Mai 2015
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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!