After dabbling in C# I'm now keen to use some OOP in Matlab - to date I've done none!
Let's say that I define a class for a data object with a handful of properties...
classdef TestRigData
properties
testTemperature
sampleNumber
testStrainAmplitude
sampleMaterial
rawData
end
methods
% Some constructors and data manipulation methods in here
end
end
...where 'rawData' would be a m-by-n array of actual experimental data, and the other values being doubles or strings to help identify each specific experiment.
If I have an array of TestRigData objects, what would be the best way of finding the indices of objects which meet specific criteria (e.g. testTemperature == 200)? Or getting all the unique values of a property (e.g. all the unique sample numbers in this collection).
If they were arrays of their own, (myNewArray = [3 5 7 22 60 60 5]) it would be easy enough using the find() and unique() functions. Is there a class I can inherit from here which will allow something like that to work on my object array? Or will I have to add my own find() and unique() methods to my class?
rawDatamatrix - AmrorawDatawinds up being pretty good sized, or at least there will be many of them. This object array will be created from order of 100MB of raw ASCII data. I will have to investigate this more, thank you. - Tom Sobj2=obj1will not immediately copy the data, but wait until you actually first modify one of the objects (lazy copy-on-write). Furthermore, each property of the object can be separately shared, so you can modify one property while the others are still shared with the original object. For handle-classobj2=obj1of course simply creates another reference to the same underlying variable, so any changes inobj2will also reflect inobj1- Amroconstkeyword to enforce this). You could confirm this by inspecting the output ofmemorybefore after creating copies of objects holding large data: undocumentedmatlab.com/blog/… - Amro