I am not sure this is possible in Matlab but wanted to make sure.
I have structures as:
x = struct();
x.val1 = 5;
x.val2 = 7;
y = struct();
y.val1 = 15;
y.val2 = 17;
I want to create a structure DataStore as:
DataStore = struct;
DataStore(x).val1 = 5
DataStore(x).val2 = 7
DataStore(y).val1 = 15
DataStore(y).val2 = 17
OR
DataStore = struct;
DataStore('x').val1 = 5
DataStore('x').val2 = 7
DataStore('y').val1 = 15
DataStore('y').val2 = 17
So, I am using the name of the original structure variables as index for DataStore.
Is the above feasible ?
Edit:
I aim to use DataStore as following:
disp( DataStore('x').val1 )
disp( DataStore('y').val2 )
Datastore.x.val1 = 5, etc.?