How to combine matrices

2 views (last 30 days)
Triveni
Triveni on 19 Aug 2021
Commented: Triveni on 19 Aug 2021
I have to combine
NETPLP(:,:,1) =
22 22.45 89.42
22 22.55 114.42
21.95 22.5 114.42
22.55 22.5 -35.59
22 22.55 114.42
22 22.45 89.42
22.05 22.5 89.42
22.45 22.5 -10.59
NETPLP(:,:,2) =
22 22.4 76.92
22 22.6 126.92
21.9 22.5 126.92
22.6 22.5 -48.09
22 22.6 126.92
22 22.4 76.92
22.1 22.5 76.92
22.4 22.5 1.91
NETPLP(:,:,3) =
22 22.35 64.42
22 22.65 139.42
21.85 22.5 139.42
22.65 22.5 -60.59
22 22.65 139.42
22 22.35 64.42
22.15 22.5 64.42
22.35 22.5 14.41
NETPLP(:,:,4) =
22 22.3 51.92
22 22.7 151.92
21.8 22.5 151.92
22.7 22.5 -73.09
22 22.7 151.92
22 22.3 51.92
22.2 22.5 51.92
22.3 22.5 26.92
NETPLP(:,:,5) =
22 22.25 39.42
22 22.75 164.42
21.75 22.5 164.42
22.75 22.5 -85.59
22 22.75 164.42
22 22.25 39.42
22.25 22.5 39.42
22.25 22.5 39.42
NETPLP(:,:,6) =
22 22.2 26.92
22 22.8 176.92
21.7 22.5 176.93
22.8 22.5 -98.09
22 22.8 176.92
22 22.2 26.92
22.3 22.5 26.92
22.2 22.5 51.92
NETPLP(:,:,7) =
22 22.15 14.42
22 22.85 189.42
21.65 22.5 189.43
22.85 22.5 -110.59
22 22.85 189.42
22 22.15 14.42
22.35 22.5 14.41
22.15 22.5 64.42
NETPLP(:,:,8) =
22 22.1 1.92
22 22.9 201.92
21.6 22.5 201.93
22.9 22.5 -123.09
22 22.9 201.92
22 22.1 1.92
22.4 22.5 1.91
22.1 22.5 76.92
NETPLP(:,:,9) =
22 22.05 -10.58
22 22.95 214.42
21.55 22.5 214.43
22.95 22.5 -135.59
22 22.95 214.42
22 22.05 -10.58
22.45 22.5 -10.59
22.05 22.5 89.42
NETPLP(:,:,10) =
22 22 -23.08
22 23 226.92
21.5 22.5 226.93
23 22.5 -148.09
22 23 226.92
22 22 -23.08
22.5 22.5 -23.09
22 22.5 101.92
>> bhu = reshape(NETPLP,[size(NETPLP,1)*size(NETPLP,3),3])
bhu =
22 22.3 14.42
22 22.7 189.42
21.95 22.5 189.43
22.55 22.5 -110.59
22 22.7 189.42
22 22.3 14.42
22.05 22.5 14.41
22.45 22.5 64.42
22.45 51.92 22
22.55 151.92 22
22.5 151.92 21.6
22.5 -73.09 22.9
22.55 151.92 22
22.45 51.92 22
22.5 51.92 22.4
22.5 26.92 22.1
89.42 22 22.1
114.42 22 22.9
114.42 21.75 22.5
-35.59 22.75 22.5
114.42 22 22.9
89.42 22 22.1
89.42 22.25 22.5
-10.59 22.25 22.5
22 22.25 1.92
22 22.75 201.92
21.9 22.5 201.93
22.6 22.5 -123.09
22 22.75 201.92
22 22.25 1.92
22.1 22.5 1.91
22.4 22.5 76.92
22.4 39.42 22
22.6 164.42 22
22.5 164.42 21.55
22.5 -85.59 22.95
22.6 164.42 22
22.4 39.42 22
22.5 39.42 22.45
22.5 39.42 22.05
76.92 22 22.05
126.92 22 22.95
126.92 21.7 22.5
-48.09 22.8 22.5
126.92 22 22.95
76.92 22 22.05
76.92 22.3 22.5
1.91 22.2 22.5
22 22.2 -10.58
22 22.8 214.42
21.85 22.5 214.43
22.65 22.5 -135.59
22 22.8 214.42
22 22.2 -10.58
22.15 22.5 -10.59
22.35 22.5 89.42
22.35 26.92 22
22.65 176.92 22
22.5 176.93 21.5
22.5 -98.09 23
22.65 176.92 22
22.35 26.92 22
22.5 26.92 22.5
22.5 51.92 22
64.42 22 22
139.42 22 23
139.42 21.65 22.5
-60.59 22.85 22.5
139.42 22 23
64.42 22 22
64.42 22.35 22.5
14.41 22.15 22.5
22 22.15 -23.08
22 22.85 226.92
21.8 22.5 226.93
22.7 22.5 -148.09
22 22.85 226.92
22 22.15 -23.08
22.2 22.5 -23.09
22.3 22.5 101.92
this matrix, but location is not appropriate. please help me for uniformity.
  2 Comments

Sign in to comment.

Accepted Answer

Wan Ji
Wan Ji on 19 Aug 2021
Hi, friend! You can achieve this by following command:
bhu = reshape(permute(NETPLP,[2,1,3]), 3, size(NETPLP,1)*size(NETPLP,3))';
  1 Comment
Wan Ji
Wan Ji on 19 Aug 2021
Edited: Wan Ji on 19 Aug 2021
Or you can use
bhu = reshape(permute(NETPLP,[1,3,2]), size(NETPLP,1)*size(NETPLP,3), 3);

Sign in to comment.

More Answers (1)

Jan
Jan on 19 Aug 2021
permute(reshape(permute(NETPLP, [2, 1, 3]), 4, []), [2, 1])
All reshaping operations of N-dimensional arrays can be solved by this approach: permute(reshape(permute(x))).
In this case permute(Y, [ 2, 1]) can be abbreviated to Y.'

Tags

Products

Community Treasure Hunt

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

Start Hunting!

Translated by