Clearing a structure variable

Hello
If I have the following structure:
a.h1 = 800; a.caseid = 'HM';
How do I clear a.h1?
Thanks

 Akzeptierte Antwort

Andrei Bobrov
Andrei Bobrov am 9 Sep. 2011

1 Stimme

a.h1 = 800; a.caseid = 'HM';
clear a.h1
a.h1 = []
remove field 'h1'
rmfield(a,'h1')

Weitere Antworten (1)

George
George am 9 Sep. 2011

0 Stimmen

Thanks Andrei! I wasn't aware of the rmfield function.
George

Kategorien

Community Treasure Hunt

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

Start Hunting!

Translated by