MATLAB: How to delete a field variable from a structure

deleteguivariables

I have variable in gui: handles.Data; Data is type: 70x50x2 logical. I need to delete the variable data. When i write: delete(handles.Data); or clean(handles.Data); then get an error: Argument must contain a string. 🙁
Thank you

Best Answer

handles.Data is a field of variable handles. To delete a field,
handles = rmfield(handles. 'Data');
To set the field to empty,
handles.Data = [];
Related Question