3

I come with the background in languages like Java or Python where modular programming is enabled by packaging system and import directive (aka namespace aliasing). Historically MATLAB's approach to resolve problems like naming conflicts boils down to setting/playing with MATLABPATH, renaming/extending identifiers with prefixes, etc. So far I have been successfully playing with native MATLAB packaging by prepending plus sign "+" before the folder name (MATLAB notation for package also see here). Obviously they are very long to type ;-) Basically I am back to the similar problem as discussed here with no solution. So let me paraphrased for my particular angle:

Assume I have folder +mypackage defined containing file myfun.m with the function code of the same name.

How to achieve aliasing for MATLAB function inside the user (non-java) package as illustrated by the following python code:

from mypackage import myfun

?

[EDIT] Please note that AFAIK import keyword works only for java classes (with jvm attached to MATLAB process). No, import is working perfectly fine for both functions and aliases for objects and function of both Java and MATLAB origin.

Possibly related but not the same.

[EDIT2]

python's

from mypackage import myfun as anotherfun

is equivalent to MATLAB's

anotherfun = @mypackage.myfun
4

1 に答える 1

2

しません

import mypackage.myfun

仕事?

ドキュメントへのリンク

于 2012-11-19T17:50:19.067 に答える