i have two martices
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Bhavana Chinnabalannagari
am 6 Nov. 2018
Kommentiert: Bhavana Chinnabalannagari
am 6 Nov. 2018
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
0 Kommentare
Akzeptierte Antwort
Stephan
am 6 Nov. 2018
x = [1 2; 3 4]
y = [5 6; 7 8]
z = [x(:) y(:)]
3 Kommentare
Stephan
am 6 Nov. 2018
Bearbeitet: Stephan
am 6 Nov. 2018
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?
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Operating on Diagonal Matrices 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!