Deleting a field from a sturcture

I have been trying to delete a field from a structure, but it keeps coming back!
I do rmfield(myStruct,myField) and it shows all the fields that strucuture has and its not on that one, but then I go look at an individual item and its back, and then I go back and look at the structure and its back there too, I am so lost. It looks like its gone, and then poof, its back. Its like herpes.
Any suggestions?

 Réponse acceptée

Brian B
Brian B le 29 Déc 2012

0 votes

Did you save the results of rmfield back to myStruct?
myStruct = rmfield(myStruct, myField)
Brian

3 commentaires

Shaun VanWeelden
Shaun VanWeelden le 29 Déc 2012
Now that you mention it, I don't think I did haha oh my, I feel like such a noob hahaha reason 104 of why you should just enjoy your Saturday instead of programming
Image Analyst
Image Analyst le 29 Déc 2012
Understandable. That would have worked in some languages, ones that have pass by reference, but MATLAB is pass by value.
Shaun VanWeelden
Shaun VanWeelden le 29 Déc 2012
I know, I think I'm just not to use to working with the structures, which by the way are pretty awesome and perfect for the project I'm doing.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by