Create several modules in Matlab?

1 次查看(过去 30 天)
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
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