Problem with Edit Text GUI

조회 수: 3 (최근 30일)
Jules Ray
Jules Ray 2013년 5월 14일
Dear all, i'm working in GUI and i have a problem with an edit-text box. Y have program a function in a button, three parameter (or variables) for the function must be defined in three different Edit-text boxes, the inputs are all numbers.
I would like to define a default value on each text box, that can be changed if the user wants. The problem is that when i run the function (pushing the button) the values are not recognized and are changed by arbitrary values like 2.270087890625000e+02.
this an example of the edit text function that i'm using:
function difu_Callback(hObject, eventdata, handles)
% hObject handle to difu (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 difu as text
% str2double(get(hObject,'String')) returns contents of difu as a double
%set(handles.difu,'String','0.9');
handles = guidata(hObject);
difu = str2num(get(handles.difu,'String'));
handles.difuf=difu;
guidata(hObject, handles);
this is for difu (diffusion) something happens but the default values are not saved in the handles. (i'm creating this GUI using GUIDE) thanks for your help
  댓글 수: 1
vinothkannan K
vinothkannan K 2013년 6월 12일
편집: vinothkannan K 2013년 6월 12일
difu = str2num(get(handles.difu,'String'));
handles.difuf=difu;
Just ur getting value from difu(tag) and storing it in difuf(tag) is that you want? Please explain clearly what is your expected result?

댓글을 달려면 로그인하십시오.

채택된 답변

yeshwanth manhcuri
yeshwanth manhcuri 2013년 5월 21일
check u r code once again......i saw commeny symbol in u r pastd code

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Data Preparation에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by