Is it possible to concatenate columns of a tensor into a single column?

6 views (last 30 days)
I am working with a 1000 x 1 x 100 tensor, lets call it A. I want to create a new variable B that containst all the rows of the tensor within a single column, i.e., B=100000 x 1. I have been using vertcat in the following way:
B= vertcat( A(:,:,1),A(:,:,2),..., A(:,:,100));
Although this technique gives me what it need, I believe there is a simpler way to do it. I hope you could suggest me a more practical approach.
Thanks, Rafael

Accepted Answer

Chunru
Chunru on 12 Nov 2021
A =randn(10,1,10);
B = A(:)
B = 100×1
-0.9363 -0.1899 -1.2740 -1.2239 0.5646 -0.1502 -1.0900 0.8784 -0.6796 0.1418

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!