Effacer les filtres
Effacer les filtres

Struct Field to Matrix large dataset

3 vues (au cours des 30 derniers jours)
Avik Mahata
Avik Mahata le 8 Oct 2021
I have a strucure which has a value of the field, 20000x5x100, what it means that it has a set of 100 matrices which has, 20000 rows and 5 columns. How do I convert it to a 2000000x5 matrix printing all the 100 sets in the sequence it has been saved in the structure?

Réponse acceptée

Dave B
Dave B le 8 Oct 2021
You can use reshape but you may wish to use permute first to get things in the right order:
a=cat(3,[1 2;3 4],[5 6; 7 8])
a =
a(:,:,1) = 1 2 3 4 a(:,:,2) = 5 6 7 8
reshape(permute(a,[1 3 2]),[],2)
ans = 4×2
1 2 3 4 5 6 7 8

Plus de réponses (0)

Catégories

En savoir plus sur Structures 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