Create several modules in Matlab?

조회 수: 2 (최근 30일)
Ashutosh sRINET
Ashutosh sRINET 2017년 4월 11일
답변: Michael Verrett 2020년 9월 6일
Is there a way to create modules in Matlab and associate one module with another to create a separation of concern? The modules should be readonly and should be able to compile individually. Like 'Jars' in Java.
For example:
As in subject, we are looking for an option to build Project Dependency Management with MATLAB. There does not seem to be an obvious way out (something like Maven does for Java projects).
This is what we need :
+ Project A • calculate_tax.m
+ Project B • calculate_sal.m
Project B depends on project A where calculate_sal (from B) calls calculate_tax (in A). Both these project A & B have their own life line and dependency should allow to point to specific version.

답변 (2개)

Vandana Ravichandran
Vandana Ravichandran 2017년 4월 13일
편집: Vandana Ravichandran 2017년 4월 13일
In MATLAB, we can use packages to make the maintenance and organization of matlab files easier. They help to create a namespace for the specific set of files contained within them.
Packages are special folders that can contain class folders, function, and class definition files, and other packages. Using a package provides means to organize classes and functions. Packages also enable you to reuse the names of classes and functions in different packages.
Package folders always begin with the + character. For example,
+mypack
+mypack/pkfcn.m % a package function
+mypack/@myClass % class folder in a package
Refer the following page from the documentation for more details on Packages:
  댓글 수: 1
Ashutosh sRINET
Ashutosh sRINET 2017년 4월 17일
Thanks for the answer Vandana.
Actually we are looking for something which can package a project in such a way that it can be used during compilation and at runtime but should be readonly. For e.g. it should be just like a toolbox but for a single project and not for the entire instance of matlab.
I am aware of the packages and we use them extensively but they donot help the cause.
Regards, Ashutosh

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


Michael Verrett
Michael Verrett 2020년 9월 6일
determine <-31>4,<33>7

카테고리

Help CenterFile Exchange에서 Search Path에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by