Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
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

Akzeptierte Antwort

Chunru
Chunru am 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

Weitere Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by