Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在学习 SciLab,我需要从 MATLAB 中找出等价物来运行用户定义的函数。
我习惯了 MATLAB,当您键入 时foo(27),它会foo.m在当前目录中查找脚本,然后在 MATLAB 路径中查找,如果找到,它会使用参数 27 调用该函数。
foo(27)
foo.m
什么是 SciLab 的等价物?它似乎不想在当前目录中查找适当的 .sci 文件。
在 Scilab 中,您需要显式加载包含该函数的脚本。假设您已将目录更改为加载函数文件的目录,这可以在 Scilab 中使用菜单按钮或以下命令完成:
cd("path/to/working/directory")
现在加载函数文件。假设函数foo存储在名为 的文件中foo.sci,您需要使用以下命令加载此脚本:
foo
foo.sci
exec("foo.sci")
现在您应该可以像在 MATLAB 中一样使用您的函数了。