Find struct size in bytes.

12 vues (au cours des 30 derniers jours)
Raldi
Raldi le 1 Juil 2014
Modifié(e) : Raldi le 1 Juil 2014
Hi all,
I have a struct element that contains some vectors and another struct that in it's turn contains some more data. What is the best way of finding the exact size in bytes of the entire struct?

Réponses (1)

Jan
Jan le 1 Juil 2014
It depends on how "the exact size" is defined. Do you mean the payload, which is the size of the data only, or do you want to consider the memory used for the headers of the fields also?
Is the output of the whos command sufficient?
  1 commentaire
Raldi
Raldi le 1 Juil 2014
Modifié(e) : Raldi le 1 Juil 2014
Good question, well that struct saves some compressed data in memory, so I guess I would also need the headers too. If possible though for educational reasons I would appreciate both methods. 'Whos' from what I tried does not provide an acceptable solution (maybe because of the fact that in my original struct there is another one nested inside)

Connectez-vous pour commenter.

Catégories

En savoir plus sur Structures dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by