Reputation: 13614
I have a dozen of scripts already and I want to group them under folders to deal with them with more ease. How could I do it? Does Matlab includes Packet hierarchy? If it does, I cannot find how to use :(.
Upvotes: 3
Views: 153
Reputation: 38032
Yes, Matlab uses package directories for that.
Group the files in a directory starting with a '+'
:
+somePackage/func1.m
+somePackage/func2.m
then, in your main script,
import someDir.*
A = func1(arg1, arg2, ...);
B = func2(arg1, arg2, ...);
or
A = somePackage.func1(arg1, arg2, ...);
B = somePackage.func2(arg1, arg2, ...);
This is basically Matlab's implementation of the concept of namespaces.
Upvotes: 5