octave: load many functions from single file

允我心安 提交于 2019-12-04 10:44:01

问题


How can I put multiple functions in one file and later get access to all of them in the octave interpreter ? I don't want to have a thousand files and want to group functions together. I'd like something like 'import' in python.


回答1:


What you're looking for is called “script files”, defined there: http://www.gnu.org/software/octave/doc/interpreter/Script-Files.html




回答2:


Once you have saved all your function definitions in a single script file, use source("filename") to have access to these functions within the interpreter.



来源:https://stackoverflow.com/questions/2068599/octave-load-many-functions-from-single-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!