Matlab:在单独的函数中从 GUI 调用句柄

Matlab: Calling a handle from GUI in a seperate function

我有以下编辑文本功能:

function startfile_Callback(hObject, eventdata, handles)

function startfile_CreateFcn(hObject, eventdata, handles)
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

我还有以下调用函数的按钮 (images_seq):

function video_Callback(hObject, eventdata, handles)
images_seq

我想要同一个 .m 文件中的 (images_seq) 函数调用 edittext 函数。 (images_seq) 函数如下所示:

function [ output_args ] = images_seq( output_name,images_dir,img_format, frame_rate, handles)

start_file = get(handles.startfile,'string');

我收到的错误如下:

Not enough input arguments.

请帮忙

首先,当你调用一个函数时,你必须输入函数需要它们的参数,在你的代码中你有这个函数

function [ output_args ] = images_seq( output_name,images_dir,img_format,frame_rate, handles)

start_file = get(handles.startfile,'string');

但是你以错误的方式调用函数调用这个函数你必须输入所有参数

 function video_Callback(hObject, eventdata, handles)
 images_seq(o_name,dir,img_f,f_rate,handles)

举个简单的例子,假设你有一个函数,这个函数名被添加到addd.m文件

function out=addd(x,y)
out=x+y;

如果你在下面的代码中输入命令 window,你会得到同样的错误

>>addd
Error using addd (line 2)
Not enough input arguments.

要调用此函数,您必须输入 x,y(输入参数)

>> addd(1,2)

ans =

     3