X =
1.0000 1.2000 1.4000 1.6000 1.8000 2.0000
1.0000 1.2000 1.4000 1.6000 1.8000 2.0000
1.0000 1.2000 1.4000 1.6000 1.8000 2.0000
1.0000 1.2000 1.4000 1.6000 1.8000 2.0000
1.0000 1.2000 1.4000 1.6000 1.8000 2.0000
1.0000 1.2000 1.4000 1.6000 1.8000 2.0000
and Y=
1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
1.2000 1.2000 1.2000 1.2000 1.2000 1.2000
1.4000 1.4000 1.4000 1.4000 1.4000 1.4000
1.6000 1.6000 1.6000 1.6000 1.6000 1.6000
1.8000 1.8000 1.8000 1.8000 1.8000 1.8000
2.0000 2.0000 2.0000 2.0000 2.0000 2.0000
and i need an n*2 matrix by pairing up corresponding elements of each of the matrices x and y. the
ex [ 1 1; 1.2 1; 1.4 1; 1.6 1; 1.8 1; 2 1; 1 1.2; 1.2 1.2;...............] and so on

 採用された回答

Stephan
Stephan 2018 年 11 月 6 日

0 投票

x = [1 2; 3 4]
y = [5 6; 7 8]
z = [x(:) y(:)]

3 件のコメント

Bhavana Chinnabalannagari
Bhavana Chinnabalannagari 2018 年 11 月 6 日
For bigger matrices, it gives away only the diagonal elements
Stephan
Stephan 2018 年 11 月 6 日
編集済み: Stephan 2018 年 11 月 6 日
No, see this example:
x = reshape(1:25,5,5)
y = reshape(26:50,5,5)
z = [x(:) y(:)]
result:
x =
1 6 11 16 21
2 7 12 17 22
3 8 13 18 23
4 9 14 19 24
5 10 15 20 25
y =
26 31 36 41 46
27 32 37 42 47
28 33 38 43 48
29 34 39 44 49
30 35 40 45 50
z =
1 26
2 27
3 28
4 29
5 30
6 31
7 32
8 33
9 34
10 35
11 36
12 37
13 38
14 39
15 40
16 41
17 42
18 43
19 44
20 45
21 46
22 47
23 48
24 49
25 50
Diagonal values would be 5 pairs - this are 25 pairs of values. I think this is what you expected - isnt it?
Bhavana Chinnabalannagari
Bhavana Chinnabalannagari 2018 年 11 月 6 日
yeah , your right.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および 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