-1

我是 matlab 新手,很快就可以制作出互连的 GUI。从具体的例子开始工作要容易得多。我找到了通用示例,但不知道哪些部分是 Matlab 函数,哪些需要编辑。是否可以为此代码演示如何将信息从edittext 传递到bladedesign.fig 以及如何在bladedesign.fig 中访问它们?

Pushbutton4 是一个提交按钮。edittext9 是一个可变文本框。

function edit9_Callback(hObject, eventdata, handles)
% hObject    handle to edit9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hints: get(hObject,'String') returns contents of edit9 as text
%        str2double(get(hObject,'String')) returns contents of edit9 as a double


% --- Executes during object creation, after setting all properties.
function edit9_CreateFcn(hObject, eventdata, handles)
% hObject    handle to edit9 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows.
%       See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
    set(hObject,'BackgroundColor','white');
end

% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
close(gcf)
openfig(bladedesign.fig)
4

1 回答 1

0

不确定我是否理解你的问题。

无花果不“做”任何事情,它就在那里,.m 文件可以更新无花果,无花果将立即反映更改

你所拥有的 %hints 几乎就是这样。

hObject,是调用调用的对象,尝试在回调中插入一个断点(F12)并检查你在那里有什么

如果您想访问其他数据,“handles”变量将拥有所有数据(尽管仅在回调上而不是在 CreateFcn 上)

所以handles.pushbutton4和handles.edit9

是您正在寻找的葡萄酒

于 2013-04-05T05:34:35.163 回答