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

조회 수: 3 (최근 30일)
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

채택된 답변

Chunru
Chunru 2021년 11월 12일
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by