MATLAB: Unable to perform assignment because dot indexing is not supported for variables of this type.

indexingstructunable to perform assignment because dot indexing is not supported for variables of this type.

Hi this is my code,
experiments(1).num = 33;
experiments(1).code = 'x';
experiments(1).weights = [200.34 202.45];
experiments(1).height.feet = 5;
experiments(1).height.inches = 6;
experiments(2).num = 11;
experiments(2).code = 't';
experiments(2).weights = [111.45 111.11];
experiments(1).height.feet = 7;
experiments(1).height.inches = 2;
I get this error whenever I run it,
Unable to perform assignment because dot indexing is not supported
for variables of this type.
Error in experimentsinitialization (line 4)
experiments(1).height.feet = 5;
When I try to call height of experiments(1), I get this,
>> experiments(1).height
ans =
5 6
However, I must get something like this,
>> experiments(1).height
ans =
feet: 5
inches: 6
What should I replace? or add?
Thank you in advance!

Best Answer

The code you posted is self-consistent. However, in some earlier code, you set
experiments(1).height = [5 6]
and you did not remove that.
My guess is that you modified your code along the way, but you did not clear the experiments variable so it still has the old data around.