Object-Object Interactions: Passing information about one object to another

2 views (last 30 days)
I am writing a program that creates objects (let us call them A, B, C, and D) and then passes information about three of the objects to the last object (e.g. reports properties of A, B, and C to object D). D then performs computations on the information that it receives from A, B, and C. Does MATLAB have some existing code element that would facilitate passing information about certain objects to other objects? I would rather not make the information about A, B, and C a property of object D.
Any advice would be much appreciated! Many thanks.
  1 Comment
per isakson
per isakson on 9 Jan 2015
You provide little context. Didn't you search the documentation or don't you think that the described approaches are good enough?
Please eleborate your question

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 9 Jan 2015
Yes. It's called a function . Pass the "reports" property of A, B, and C into a function, and also pass in the entire D object.
output = ProcessObjects(A.reports, B.reports, C.reports, D);
Then define the function
function output = ProcessObjects(report1, report2, report3, D)
% Then do something with the inputs and create an output
output = ..... whatever......
  1 Comment
Image Analyst
Image Analyst on 9 Jan 2015
You can also make a "method" of D that takes the "reports" properties of other objects and does something with them.

Sign in to comment.

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!