How can i concatenate array of 3 to form single matrix?
1 ビュー (過去 30 日間)
i am very new to matlab, so sorry if i sounded stupid
i just need to get an output of 3 array from my looping and form one single 3d matrix
100 array x 10 array x 12 array and store it as 3d matrix
so that the size will be : 100 x 10 x 12
and thank you in advanced
Jan 2017 年 1 月 29 日
編集済み: Jan 2017 年 1 月 29 日
A bold guess:
x = 1:100;
y = 1:10;
z = 1:12;
Result = reshape(x, , 1, 1) + reshape(y, 1, , 1) + reshape(z, 1, 1, );
Here I assumes, that you want to combine the values by an addition.
This runs in R2016b. The reshape commands are formulated equivalently for demonstration purposes only: In the first you can omit the trailing 1, the second is not needed because y has the wanted shape already.
For earlier version, the addition of arrays with different shapes required bsxfun:
Result = bsxfun(@plus, reshape(x, , 1, 1), ...
bsxfun(@plus, reshape(y, 1, , 1), reshape(z, 1, 1, )));