Unable to delete variable

조회 수: 6 (최근 30일)
Danielle Sloan
Danielle Sloan 2021년 3월 11일
답변: Rik 2021년 3월 11일
I have a variable (zeta) that I want to delete from a structure (A).
I tried to use the removevars() function:
A1 = removevars(A, ('zeta'));
and got the following error message:
"Undefined function 'removevars' for input arguments of stype 'struct'."
When I used which removevars it showed me the path for the function (C:\Program Files\MATLAB\R2019a\toolbox\matlab\datatypes\@tabular\removevars.m % tabular method) so why is it not working?

채택된 답변

Rik
Rik 2021년 3월 11일
removevars will only work on tables, not on structs. Use rmfield to remove a field from a struct.

추가 답변 (0개)

카테고리

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