Is there a term for "mypack.mysubpack.myFcn"?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
per isakson
el 25 de En. de 2017
Comentada: per isakson
el 27 de En. de 2017
Please give me a term for the text string, which is used to invoke a function. Before package folders were introduced function name or when context allowed name were good unambiguous terms.
For example, consider this package function: +mypack\+mysubpack\myFcn.m. The function name is myFcn, but to invoke the function mypack.mysubpack.myFcn is required. I cannot think of a better term than full function name.
Referencing Package Members from Outside the Package
Functions, classes, and other packages contained in a package are scoped to that
package. To reference any of the package members, prefix the package name to the
member name, separated by a dot.
0 comentarios
Respuesta aceptada
Walter Roberson
el 27 de En. de 2017
I would probably go by analogy with DNS, and refer to "function name", "qualified function name", and "fully qualified function name"
2 comentarios
Más respuestas (1)
Chirag Parekh
el 27 de En. de 2017
Editada: Chirag Parekh
el 27 de En. de 2017
You can import the package in your script or function from where you want to call +mypack\+mysubpack\myFcn.m
Suppose you want to call myFcn() from script myScript.m, import mypack.mysubpack.* in myScript.m and then you can call myFcn() without the package specifiers in the script. You can also import packages in functions.
%myScript.m
import mypack.mysubpack.*
myFcn();
In case you are using folders(mypack/mysubpack) and not packages(+mypack/+mysubpack), you should be able to call myFcn() without the full folder specifier as long as it is on MATLAB path.
1 comentario
Walter Roberson
el 27 de En. de 2017
Yes but the question was about what descriptive term to use, not about what could be done with them.
Ver también
Categorías
Más información sobre Software Development Tools en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!