I have a user-defined class type named classAvengerTrack. The purpose of this is to be a container for radar data on a specific track, so you can imagine that you might have many intances of this class to describe all the tracks in a given radar data set, and that naturally each instance would have a different variable name, such as 'track543'
One of the properties in classAvengerTrack is a table of position reports, with columns such as timestamp, latitude, longitude, etc. So if I wanted to access that table of position reports for a specific track I would use:
Simple enough so far.
I want the user to be able to save as specific instance of this object to a .mat file. I want to be able to load that .mat file in another function and act on that postionsReport table. The trouble is, I won't necessarily know the original variable name. For example:
userSavedObject = 'airTrack.mat'
track = load (userSavedObject);
Will load the object into a struct. If I knew that the user saved an instance of the classAvengerTrack object named 'track543' then getting to the positionReports table would be as easy as:
However, the function loading the .mat file has no prior knowledge of this file, only that it is expected to be an object of type classAvengerTrack.
Question: How do I reference a property of an object that is trapped in struct?
I have tried every variation of indexing I can think of. I either get an error, or I get this:
Reference to non-existent field 'positionReports'.
struct with fields:
ft1AirTruth_Avenger: [1×1 classAvengerTrack]
Any help you can provide to restore my sanity is greatly appreciated. I'm using version R2017a.