pointers in object-oriented matlab programing
Ältere Kommentare anzeigen
I want to create several objects that can "communicate with each other"
for instance, let's say i have a class called "child" and a class called "woman", and i want each child to have a property "mother" and each woman to have a property "children". these properties should contain some sort of pointer to the other objects, so that i can (for instance) add a function to the "woman" class named "feed_children" and i can go over all all her children and change some parameter.
is there a way to do this? i note here that i don't want to simply use some sort of structure, where the children are contained in a "struct" inside the "mother" object. i want all the objects to appear in the workspace and have independent existence, but to have some way of pointing at each other. i know that in many object oriented languages this is very easy to do
many thanks
i attach here my code if anyone is interested, the "TA_system" class is the mother (components are children) and a duct is a component.
2 Kommentare
Walter Roberson
am 27 Aug. 2020
MATLAB objects derived from "handle" class effectively use pointers.
Nathan Blanc
am 27 Aug. 2020
Akzeptierte Antwort
Weitere Antworten (1)
James Tursa
am 27 Aug. 2020
0 Stimmen
MATLAB does not have variable pointers ... at least not in the sense of C/C++ like you are probably alluding to.
1 Kommentar
Nathan Blanc
am 27 Aug. 2020
Kategorien
Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!