Azzera filtri
Azzera filtri

Struct Field to Matrix large dataset

3 visualizzazioni (ultimi 30 giorni)
Avik Mahata
Avik Mahata il 8 Ott 2021
Risposto: Dave B il 8 Ott 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?

Risposta accettata

Dave B
Dave B il 8 Ott 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

Più risposte (0)

Categorie

Scopri di più su Structures in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by