Clear Filters
Clear Filters

Create several modules in Matlab?

6 views (last 30 days)
Ashutosh sRINET
Ashutosh sRINET on 11 Apr 2017
Answered: Michael Verrett on 6 Sep 2020
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.

Answers (2)

Vandana Ravichandran
Vandana Ravichandran on 13 Apr 2017
Edited: Vandana Ravichandran on 13 Apr 2017
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 Comment
Ashutosh sRINET
Ashutosh sRINET on 17 Apr 2017
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

Sign in to comment.


Michael Verrett
Michael Verrett on 6 Sep 2020
determine <-31>4,<33>7

Categories

Find more on Search Path 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!