MATLAB: Is there a way of avoiding repeating the structure name when calling or setting the different fields of that structure

structures

Hi,
Is there a way of avoiding repeating the structure name when calling or setting the different fields of that structure? For instance instead of doing:
patient.name = 'John';
patient.age = '32';
I would like to do something like (this does not work…)
with patient
.name = 'John';
.age = 32;
end
This would make my code so much lighter and easier to read 🙂

Best Answer

patient = struct('name','John','Age',32) ;
doc struct.