Effacer les filtres
Effacer les filtres

How to know if exist an field into a struct?

4 vues (au cours des 30 derniers jours)
jon
jon le 14 Avr 2016
Commenté : jon le 14 Avr 2016
I want a funtion which give me "0" if dosen't exist a field into a struct and "1" if it exist, something like that:
s=struct("field1",val1,"field2",val2,"field3",val3);
exist(s.field1)
=1
exist(s.field5)
=0

Réponse acceptée

Steven Lord
Steven Lord le 14 Avr 2016
Take a look at isfield.
  1 commentaire
jon
jon le 14 Avr 2016
It works perfect Thanks

Connectez-vous pour commenter.

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