Unable to delete variable

6 Ansichten (letzte 30 Tage)
Danielle Sloan
Danielle Sloan am 11 Mär. 2021
Beantwortet: Rik am 11 Mär. 2021
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?

Akzeptierte Antwort

Rik
Rik am 11 Mär. 2021
removevars will only work on tables, not on structs. Use rmfield to remove a field from a struct.

Weitere Antworten (0)

Kategorien

Mehr zu Structures finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by