Info

This question is closed. Reopen it to edit or answer.

hello, i have a question, how to build the value of an Edit Text and push it in a 'MyDrawing' button in gui; and where exactly should i put this change in my code?, this is my code

1 view (last 30 days)
% --- Executes during object creation, after setting all properties.
function slfmin_CreateFcn(hObject, eventdata, handles)
% hObject handle to slfmin (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: slider controls usually have a light gray background.
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
% --- Executes during object creation, after setting all properties.
function MyDrawing_CreateFcn(hObject, eventdata, handles)
% hObject handle to MyDrawing (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
epsl = get(hObject,'value');
set(findobj('Tag','editepsL'),'String',epsl);
% Hint: place code in OpeningFcn to populate MyDrawing
% --- Executes on button press in pbDessiner.
function pbDessiner_Callback(hObject, eventdata, handles)
% hObject handle to pbDessiner (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global N fmin fmax df epsh epsl ah al
[T,R] = bragg(N, fmin,fmax,df,epsh,epsl,ah,al);
plot(fmin:df:fmax,R);
grid on;
% --- Executes on key press with focus on pbDessiner and none of its controls.
function pbDessiner_KeyPressFcn(hObject, eventdata, handles)
% hObject handle to pbDessiner (see GCBO)
% eventdata structure with the following fields (see UICONTROL)
% Key: name of the key that was pressed, in lower case
% Character: character interpretation of the key(s) that was pressed
% Modifier: name(s) of the modifier key(s) (i.e., control, shift) pressed
% handles structure with handles and user data (see GUIDATA)

Answers (1)

Image Analyst
Image Analyst on 24 May 2015
In the button callback MyDrawing_CreateFcn(), get the edit text and use it somehow:
editText = get(handles.edittext1, 'String');
% more code that uses editText......

Community Treasure Hunt

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

Start Hunting!