Using User-defined class' object in another user-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?

 채택된 답변

Matt J
Matt J 2012년 10월 14일

0 개 추천

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

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!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Community Treasure Hunt

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

Start Hunting!

Translated by