MATLAB: How to rename fields in struc and adding new field name

struct

Hello everyone
I have a stuct to work wit and i wonted to rename the field name (XX) by 'Area (km2)' and also i wanted to add new filed column between YY and ZZ as shown below.
wish you best

Best Answer

struct fieldnames must be valid MATLAB identifiers, so spaces and brackets are not permitted.
The characters are permitted in the names of Variables in table() objects.
To add a new field at a particular location, the easiest way is to add the new field and then to use orderfields() to change the order.