Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

data transfer in guide

3 Ansichten (letzte 30 Tage)
Itzik Ben Shabat
Itzik Ben Shabat am 13 Jan. 2013
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 Kommentar
Azzi Abdelmalek
Azzi Abdelmalek am 13 Jan. 2013
Your question is not clear, what do you mean by: i wish to have a default value read and assigned ?

Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by