フィルターのクリア

Create a matrix from another matrix

1 回表示 (過去 30 日間)
Giannakis Stoukas
Giannakis Stoukas 2015 年 5 月 4 日
編集済み: Stephen23 2015 年 5 月 4 日
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 Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by