如何解决MATLAB中的名称冲突? [英] How do I resolve name conflict in MATLAB?

查看:95
本文介绍了如何解决MATLAB中的名称冲突?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在MATLAB中创建了一个称为堆栈"的GUI.它具有与.m相关的文件.同一文件夹中的另一个GUI多次调用此GUI.

I created a GUI called "stack" in MATLAB. It has a .m file associated with it. This GUI is called on multiple occasions by another GUI in the same folder.

现在,我发现"堆栈"是内置函数在MATLAB中,我需要在同一工作目录中使用其他功能.所有对堆栈函数的调用都通过调用stack.m脚本以某种方式调用GUI.

Now I discovered that "stack" is a built-in function in MATLAB which I need to use for something else in the same working directory. All calls to the stack function somehow invoke the GUI by calling the stack.m script.

我不想重命名,因为它在很多地方都使用过.

I do not want to rename this because it is used in many places.

是否有一种无需重命名即可使用内置函数的方法?有什么方法可以分别引用函数和脚本?

Is there a way to use the built-in function without needing to rename? Some way to reference the function and the script separately?

推荐答案

免责声明:请不要这样做.

假设您自己的stack.m因为位于当前文件夹中而仅位于搜索路径中,那么最简单的解决方法是创建一些虚拟子文件夹,导航至该子文件夹,然后执行Matlabs stack函数(这是唯一的stack(在当前搜索路径中),然后向后导航.

Assuming that your own stack.m is only in the search path because it is in the current folder, then the easiest fix is to create some dummy subfolder, navigate to it, execute Matlabs stack function (which is the only stack in the current searchpath) and navigate back.

在这里,我以magic为例:

function a= magic
n=5;
cd dummy
a= magic(n);
cd ..

其中dummy是子文件夹的名称.

where dummy is the name of the subfolder.

这篇关于如何解决MATLAB中的名称冲突?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆