MATLAB: Using User-defined class’ object in another user-defined class.

objectuser defined class

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?

Best Answer

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.