Using User-defined class' object in another user-defined class.

1 view (last 30 days)
Hi, I am really new to matlab, and need help for this. Say I have defined a class Node. The name of the file is then Node.m. I have another class, Element, saved in file Element.m. How do I access the object of class Node in the file Element.m, or any other file for that matter?

Accepted Answer

Matt J
Matt J on 14 Oct 2012
There's no reason why you can't call Node's constructor inside Element.m as long as both Node.m and Element.m are visible to MATLAB, e.g., both are on the MATLAB path.
  1 Comment
Shruti Motiwale
Shruti Motiwale on 15 Oct 2012
Thanks a lot for your reply. I had kept the path same but apparently there was some other error, I tried changing some things and it worked!

Sign in to comment.

More Answers (0)

Categories

Find more on Software Development Tools in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!