Clearing a structure variable

72 views (last 30 days)
George
George on 9 Sep 2011
Hello
If I have the following structure:
a.h1 = 800; a.caseid = 'HM';
How do I clear a.h1?
Thanks

Accepted Answer

Andrei Bobrov
Andrei Bobrov on 9 Sep 2011
a.h1 = 800; a.caseid = 'HM';
clear a.h1
a.h1 = []
remove field 'h1'
rmfield(a,'h1')

More Answers (1)

George
George on 9 Sep 2011
Thanks Andrei! I wasn't aware of the rmfield function.
George

Categories

Find more on Structures in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!