How to separate the field from a structure in MATLAB?
35 views (last 30 days)
I have a structure which is attached with this file named as 'shape.mat'. The structure contains the following fields: Geometry Boundary X Y...etc Now i want to separate X and Y field from the structure and store it in a cell named x_constraint and y_constraint respectively. Can it be done?
More Answers (2)
Guillaume on 3 Oct 2016
Well, unless I completely misunderstood your question:
x_constraint = yourstructure.X;
y_constraint = yourstructure.Y;
However, there is no benefit to that. Why not use yourstructure.X whenever you want x_constraint and not bother creating x_constraint in the first place?