简体   繁体   English

在MATLAB GUIDE中执行函数调用

[英]Execute a function call in MATLAB GUIDE

In MATLAB: 在MATLAB中:

I have this independent function which runs optimal in the command line: 我有这个独立的功能,可以在命令行中最佳运行:

function datacollect()
filename = uigetfile('*.txt')
[col] = importdata(fileName)
long = columns(:,1)
lat = columns(:,2)
handles.long = long;
handles.lat = lat;

But when I make a function call inside GUIDE: 但是当我在GUIDE中进行函数调用时:

datacollect()

I get an error: 我收到一个错误:

??? ??? Reference to non-existent field 'output'. 引用不存在的字段“输出”。

My guess is that there is a name collision between the handles variable in GUIDE that is being used for saving graphics handles and other data, and the one that your function uses. 我的猜测是, GUIDE中用于保存图形句柄和其他数据的handles变量与函数使用的变量之间存在名称冲突。

Try to rename handles in your function to something else, and run again. 尝试将函数中的handles重命名为其他名称,然后再次运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM