I am trying to add a datapoint to an existing data struct. I have created the following data struct.
ourdata.animal= {'wolf', 'dog', 'cat'}
ourdata.height = [110 51 32]
ourdata.weight = [55 22 10]
say I want to add another one to the data struct with name 'fish'
height 3
and weight 1
, how do I go about this?
CodePudding user response:
You can simply attach it to the end of the structure:
ourdata.animal{end 1} = 'fish'
ourdata.height(end 1) = 3
ourdata.weight(end 1) = 1