Filter löschen
Filter löschen

. 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 Ansicht (letzte 30 Tage)
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 !!

Antworten (1)

Shanmukha Voggu
Shanmukha Voggu am 3 Sep. 2021
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.

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by