MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   在MATLAB中将自写函数的范围设置为global (https://www.labfans.com/bbs/showthread.php?t=26259)

poster 2019-12-14 20:13

在MATLAB中将自写函数的范围设置为global
 
假设我已经在Matlab中编写了一个函数fun(a,b,c)并将其保存为.. \ My Documents \ MATLAB \ fun.m。如何使它可用于Matlab中的所有功能。

换句话说:为了从任何其他matlab文件(脚本,函数)调用此函数而又不在文件存储目录中需要做什么?



[B]回答:[/B]

我相信您可以通过将文件添加到路径中来实现这种效果-http: [URL="http://web.cecs.pdx.edu/~gerry/MATLAB/howTo/setMATLABpath.html#pathCommand"]//web.cecs.pdx.edu/~gerry/MATLAB/howTo/setMATLABpath.html#pathCommand[/URL]



[url=https://stackoverflow.com/questions/4865052]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 23:16

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.