Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
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

Réponse acceptée

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

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by