2013-04-05 45 views
-1

我是matlab新手,并没有太长的时间来生成相互连接的GUI。从特定的例子开始工作要容易得多。我已经找到了通用的例子,但不知道哪些部分是Matlab函数,哪些需要编辑。是否有可能证明此代码如何将来自edittext的信息传递到bladedesign.fig以及如何在bladedesign.fig中访问它们?在Matlab中的GUI之间传递变量

按钮4是一个提交按钮。 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) 

回答

0

不知道我明白你的问题。

无花果不“做” anyhthing,它只是存在, .m文件可以更新无花果,无花果会立即反映更改

的提示%你必须有相当多它。

的hObject,是调用调用的对象,请尝试将回调一个破发点(F12),并检查是否有什么在那里

的情况下,你要访问其他数据的“把手”变量都有他们都(虽然只在回调不CreateFcn)

所以handles.pushbutton4 和handles.edit9

是你正在寻找的wones

+0

对不起我的意思designblade.m 所以在designblade.m我可以访问menu.m中的句柄? 我只需要在designblade.m中以相同的方式调用数据,因为我必须稍后在menu.m中进行计算。 – Marc 2013-04-06 20:01:25