我有一个读取 2 个文件并将它们分配给 2 个变量的函数:
skelfile='data/name.asf'; %asf and amc files are associated,both needed for later stages
motfile='data/name.amc';
[skel,mot]=readMocap(skelfile,motfile);%the function that i need to use is the readMocap
上面的代码将给变量 skel,mot 作为 1X1 结构,其中包含数字和字符的信息(包含数字、单元格、字符串、aarays 作为结构字段)。
问题是如何使用 Gui 中的函数!!我使用一个按钮来加载 2 个文件并在 2 个静态文本中显示两个 asf、amc 文件的文件名 asf、amc 文件是包含人体骨骼的运动捕捉数据的文件,其中 asf 具有关于骨骼的信息和关于运动的 amc (帧序列)
function pushbutton_Callback(hObject, eventdata, handles)
% hObject handle to load_MoCap (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[filename, pathname] = uigetfile('*.asf', 'MoCap files');
% show name at the static texts
if isequal(filename,0)
set(handles.asf_filename, 'String', 'Please select an .asf file to continue')
else
set(handles.asf_filename, 'String', filename)
skelfile=filename;
[filename2, pathname2] = uigetfile('*.amc;*.c3d', 'MoCap files');
if isequal(filename2,0)
set(handles.amc_filename, 'String', 'Please select an .amc file to continue')
else
set(handles.amc_filename, 'String', filename2)
%the problem
============
%from here i want to run the function and have at a static text the text that
%have when i write skel in the command promt of matlab, or at least somehow
%evaluate tha skel and mot have been assigned as structs
motfile=filename;
[skel,mot]= readMocap(skelfile, motfile);
handles.skel=skel;
handles.mot=mot;
set(handles.skel_mot,'String',skel)
% skel_mot is the static text that refer above
%and i use as property type at the set command th 'string' but i don't think
%that is correct . skel variable is a 1x1 struct
end
end
guidata(hObject,handles);
当您启动空白 gui 时,我的代码中除了默认值之外没有其他任何内容。a)我是否必须在 gui 的打开功能处添加一些东西(句柄)?我不想在加载文件之前启动一些东西。b)我想将文件中的信息用作将从 gui 调用的其他函数的输入,所以当我在 gui 中调用函数时如何将它们用作输入?作为 skel、mot 或 handle.skel,手柄.mot??
预先感谢您的任何回复。