I am trying to write a function in which I give two arguments: one is a previously defined structure which basically contains the variables of my dataset, as column numerical or string vector, and the other would be the name of one of the variables (as a string).
I have not managed to figure out yet how to use the name of the variable to access the member of the structure.
Suppose the structure is called st1 and the string is string1 = "num".
How do I access st1.num in the function by using string1?
I have not managed to figure out yet how to use the name of the variable to access the member of the structure.
Suppose the structure is called st1 and the string is string1 = "num".
How do I access st1.num in the function by using string1?
Comment