- #1
peterjaybee
- 62
- 0
Hi I am trying to use MATLAB for some data analysis. I start by getting user input for a variable called exptno, Then I want to access a location in a structure, but to do this I need to append the variable exptno to the name of the structure. Ill try and give an example to hopefully make it cleared.
I have structure called experiments and substructures called Expt_1, Expt_2, Expt_3, Expt_4 etc... and I want to get a value from in the Expt_# substructure (called spectralfrequencyTD2) based on the value that the user has input to exptno.
The original method I tried was as follows using the int2str command. This doesn't work, but hopefully it will give you some idea of what I m trying to do.
LarmorFreq = experiments.Expt_int2str(exptno).SpectralFrequencyTD2
Thanks,
Peter
I have structure called experiments and substructures called Expt_1, Expt_2, Expt_3, Expt_4 etc... and I want to get a value from in the Expt_# substructure (called spectralfrequencyTD2) based on the value that the user has input to exptno.
The original method I tried was as follows using the int2str command. This doesn't work, but hopefully it will give you some idea of what I m trying to do.
LarmorFreq = experiments.Expt_int2str(exptno).SpectralFrequencyTD2
Thanks,
Peter