Info
この質問は閉じられています。 編集または回答するには再度開いてください。
data transfer in guide
1 回表示 (過去 30 日間)
古いコメントを表示
Hi , I have built a user interface in guide. i wish to allow the user to enter numeric values and set them to some variables that would be available to all functions in the program. to do this i used the text editing option and used the function attached below. i assigned the values to handles and used guidata() at the end
However, this forces me to set the value of Zc every time. i wish to have a default value read and assigned. how can i do that? thanks
function Zc_Callback(hObject, eventdata, handles)
% hObject handle to Zc (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.SphereCenterZ=str2double(get(hObject,'String'));
% Hints: get(hObject,'String') returns contents of Zc as text
% str2double(get(hObject,'String')) returns contents of Zc as a double
guidata(hObject,handles);
end
% --- Executes during object creation, after setting all properties.
function Zc_CreateFcn(hObject, eventdata, handles)
% hObject handle to Zc (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
end
1 件のコメント
Azzi Abdelmalek
2013 年 1 月 13 日
Your question is not clear, what do you mean by: i wish to have a default value read and assigned ?
回答 (0 件)
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!