matlabmatlab-struct

Matlab Struct Manipulation


I have a struct, D

    whos D
    Name      Size             Bytes  Class     Attributes
    D         1x128            93372  struct 

Opening up the variable from the workspace, I have 128 <1x1 struct> fields. How can I delete, for example, all elements of the 3rd, 11th and 100th substructure, so that I am left with a smaller version of D, of size 1x125?

Many thanks.


Solution

  • I'm a muppet. To delete the 10th element, simply:

        D(:,10)=[];
    

    Apologies for the unnecessary question!