How to edit text box
3 次查看(过去 30 天)
显示 更早的评论
I have a edit box and a push button I want to make the push button do whatever I put in the edit box but I dont know how to do this
2 个评论
Chandler Hall
2022-11-15
Are you sure drop-down box is not more appropriate? What sort of strings do you expect the user to input and how do you want that to correlate with the outcome?
回答(1 个)
Chandler Hall
2022-11-15
编辑:Chandler Hall
2022-11-15
fig = uifigure;
edit = uieditfield(fig, 'numeric');
btn = uibutton(fig, 'position', [200 100 100 22]);
label = uilabel(fig, 'position', [350 100 100 22]);
btn.ButtonPushedFcn = {@button_pushed, edit, label};
function button_pushed(obj, event, edit, label)
use_value(edit.Value, label);
end
function use_value(user_in, label)
label.Text = string(user_in);
end
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!