Clearing a structure variable

조회 수: 22 (최근 30일)
George
George 2011년 9월 9일
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일
a.h1 = 800; a.caseid = 'HM';
clear a.h1
a.h1 = []
remove field 'h1'
rmfield(a,'h1')

추가 답변 (1개)

George
George 2011년 9월 9일
Thanks Andrei! I wasn't aware of the rmfield function.
George

카테고리

Help CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by