. How do I Change the value in The Edit FIeld Box ( such as- Sample No : 01 , Sample no :02... so on) utpo 10 samples, by clicking on pushbutton.?

1 次查看(过去 30 天)
I Have Created a GUI with app designer in MATLAB 2020. I am trouble in finding this, I want 10 Samples to be displayed on the app.EditField text Box , one-by-one with the click on the Push Button !!

回答(1 个)

Shanmukha Voggu
Shanmukha Voggu 2021-9-3
Hi Shaik Asif,
Customizing call back functions and startupFnc helps to achieve the above task,
1)Edit the startup function of the app as
function startupFcn(app)
app.EditField.Value="Sample No : 01"; %initial value displayed
end
2)Edit the call back of the push button as
function ButtonPushed(app, event)
newStr = extractAfter(app.EditField.Value,": "); %extracting the sample number into string
if newStr=="09"
app.EditField.Value="Sample No : 10";
elseif newStr=="10"
app.EditField.Value="Sample No : 01";
else
app.EditField.Value=replace(app.EditField.Value,newStr,"0"+num2str(str2num(newStr)+1)); %incrementing the sample number and updating it
end
end
Attached the samples named MLAPP, Refer this for more information.

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by