Get variable from edittext
古いコメントを表示
Hey, basicly I made a gui with 3 inputtext fields and a button. When pressing the button it should put the data from the input field into a variable and then start a function with these variables. If i declare the variables with just a regular variable it seems to work.(see commented example) How do i read the edittext?
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
disp('start running code');
handles = guidata(hObject);
var1 = get(handles.edit1, 'string');
var2 = get(handles.edit2, 'string');
var3 = get(handles.edit3, 'string');
%var1 = 2;
%var2 = 0.5;
%var3 = 300;
freessimulatie(var1,var2,var3);
採用された回答
その他の回答 (1 件)
Walter Roberson
2018 年 7 月 26 日
var1 = str2double( get(handles.edit1, 'string') );
var2 = str2double( get(handles.edit2, 'string') );
var3 = str2double( get(handles.edit3, 'string') );
2 件のコメント
Ben Aerens
2018 年 7 月 26 日
Walter Roberson
2018 年 7 月 26 日
That implies that handles was not a handles structure, which is a problem that would be associated with CreateFcn but not with pushbutton callbacks.
カテゴリ
ヘルプ センター および File Exchange で Data Type Identification についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!