Clearing a structure variable

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

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2011년 9월 9일

1 개 추천

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

추가 답변 (1개)

George
George 2011년 9월 9일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by