How can I store the 100 rows of the array in one Matrix?

1 view (last 30 days)
M
M on 1 Apr 2022
Commented: M on 1 Apr 2022
There is an array X with size (1*3*100)
This is part from array X:
val(:,:,1) =
0 0 0
val(:,:,2) =
-0.0141 -0.0508 0.0786
val(:,:,3) =
0.0067 0.0035 0.0466
val(:,:,4) =
-0.0082 -0.0357 0.1057
.
.
.
.
How can I store the 100 rows of the array in one Matrix?
As the following:
M= [0 0 0
-0.0141 -0.0508 0.0786
0.0067 0.0035 0.0466
-0.0082 -0.0357 0.1057
.
.
.
]

Accepted Answer

Stephen23
Stephen23 on 1 Apr 2022
format compact
X = rand(1,3,100)
X =
X(:,:,1) = 0.2610 0.7753 0.1906 X(:,:,2) = 0.4463 0.8890 0.9545 X(:,:,3) = 0.0754 0.2577 0.3922 X(:,:,4) = 0.1844 0.1592 0.2030 X(:,:,5) = 0.5921 0.9162 0.3389 X(:,:,6) = 0.6233 0.7575 0.9247 X(:,:,7) = 0.5424 0.3020 0.0392 X(:,:,8) = 0.0321 0.5100 0.8204 X(:,:,9) = 0.4460 0.4485 0.3025 X(:,:,10) = 0.3534 0.2574 0.9295 X(:,:,11) = 0.9426 0.3157 0.6158 X(:,:,12) = 0.1833 0.0886 0.0745 X(:,:,13) = 0.1382 0.4573 0.6580 X(:,:,14) = 0.3467 0.4151 0.8104 X(:,:,15) = 0.6849 0.5989 0.2851 X(:,:,16) = 0.2252 0.8867 0.4931 X(:,:,17) = 0.9749 0.6078 0.3188 X(:,:,18) = 0.2712 0.3518 0.3717 X(:,:,19) = 0.7859 0.6830 0.5968 X(:,:,20) = 0.0304 0.5481 0.4461 X(:,:,21) = 0.1388 0.9546 0.5119 X(:,:,22) = 0.9788 0.5397 0.4085 X(:,:,23) = 0.7342 0.0590 0.6495 X(:,:,24) = 0.0670 0.0458 0.8988 X(:,:,25) = 0.6265 0.9745 0.9822 X(:,:,26) = 0.3195 0.1942 0.0645 X(:,:,27) = 0.6318 0.4194 0.0178 X(:,:,28) = 0.1456 0.0349 0.9779 X(:,:,29) = 0.8615 0.9460 0.3660 X(:,:,30) = 0.6253 0.6522 0.1224 X(:,:,31) = 0.5275 0.7047 0.5588 X(:,:,32) = 0.1782 0.0553 0.6049 X(:,:,33) = 0.3509 0.7955 0.4287 X(:,:,34) = 0.4076 0.9453 0.5513 X(:,:,35) = 0.5998 0.6466 0.6220 X(:,:,36) = 0.3703 0.5884 0.0190 X(:,:,37) = 0.3498 0.2052 0.3905 X(:,:,38) = 0.7141 0.5986 0.4892 X(:,:,39) = 0.0370 0.6431 0.3851 X(:,:,40) = 0.0538 0.9922 0.0875 X(:,:,41) = 0.8844 0.4010 0.2841 X(:,:,42) = 0.5577 0.5440 0.6333 X(:,:,43) = 0.6519 0.1123 0.8019 X(:,:,44) = 0.7565 0.3836 0.3348 X(:,:,45) = 0.1791 0.2293 0.2110 X(:,:,46) = 0.2157 0.8277 0.6748 X(:,:,47) = 0.5985 0.6912 0.0494 X(:,:,48) = 0.6085 0.7494 0.7303 X(:,:,49) = 0.9907 0.4936 0.5521 X(:,:,50) = 0.1180 0.5213 0.2927 X(:,:,51) = 0.2952 0.1809 0.2030 X(:,:,52) = 0.9577 0.7023 0.3917 X(:,:,53) = 0.8664 0.3853 0.6261 X(:,:,54) = 0.1340 0.5765 0.1492 X(:,:,55) = 0.5226 0.0813 0.0564 X(:,:,56) = 0.2217 0.8792 0.7096 X(:,:,57) = 0.3707 0.4235 0.4360 X(:,:,58) = 0.8633 0.5735 0.1470 X(:,:,59) = 0.2653 0.7682 0.5466 X(:,:,60) = 0.3193 0.5594 0.1601 X(:,:,61) = 0.6760 0.0574 0.3759 X(:,:,62) = 0.0226 0.1508 0.2988 X(:,:,63) = 0.4270 0.5699 0.2162 X(:,:,64) = 0.2079 0.5522 0.1885 X(:,:,65) = 0.6581 0.6746 0.7571 X(:,:,66) = 0.3552 0.0817 0.9710 X(:,:,67) = 0.0206 0.2665 0.7204 X(:,:,68) = 0.6667 0.6415 0.7206 X(:,:,69) = 0.6568 0.6219 0.6664 X(:,:,70) = 0.7361 0.8025 0.5165 X(:,:,71) = 0.3700 0.9351 0.5992 X(:,:,72) = 0.2560 0.7981 0.4384 X(:,:,73) = 0.8505 0.5719 0.8086 X(:,:,74) = 0.1736 0.2363 0.7825 X(:,:,75) = 0.9378 0.8656 0.4070 X(:,:,76) = 0.4563 0.8930 0.3503 X(:,:,77) = 0.1596 0.5364 0.6910 X(:,:,78) = 0.2042 0.0699 0.4360 X(:,:,79) = 0.8038 0.4405 0.4835 X(:,:,80) = 0.1334 0.2420 0.6274 X(:,:,81) = 0.0375 0.9518 0.3643 X(:,:,82) = 0.1320 0.2951 0.5107 X(:,:,83) = 0.2021 0.0310 0.7291 X(:,:,84) = 0.2158 0.1530 0.4583 X(:,:,85) = 0.4505 0.3231 0.4161 X(:,:,86) = 0.9432 0.6858 0.7724 X(:,:,87) = 0.9257 0.7490 0.2286 X(:,:,88) = 0.6480 0.4304 0.8711 X(:,:,89) = 0.1514 0.2978 0.8251 X(:,:,90) = 0.3794 0.5596 0.9140 X(:,:,91) = 0.8523 0.0166 0.5449 X(:,:,92) = 0.2890 0.7142 0.7286 X(:,:,93) = 0.2178 0.4563 0.7055 X(:,:,94) = 0.7325 0.7849 0.3318 X(:,:,95) = 0.6584 0.3747 0.0224 X(:,:,96) = 0.6556 0.8711 0.1207 X(:,:,97) = 0.4160 0.3767 0.8468 X(:,:,98) = 0.8686 0.3400 0.1803 X(:,:,99) = 0.5421 0.5031 0.5253 X(:,:,100) = 0.4931 0.4501 0.4782
Y = permute(X,[3,2,1])
Y = 100×3
0.2610 0.7753 0.1906 0.4463 0.8890 0.9545 0.0754 0.2577 0.3922 0.1844 0.1592 0.2030 0.5921 0.9162 0.3389 0.6233 0.7575 0.9247 0.5424 0.3020 0.0392 0.0321 0.5100 0.8204 0.4460 0.4485 0.3025 0.3534 0.2574 0.9295

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by