. 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.?

2 visualizaciones (últimos 30 días)
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 !!

Respuestas (1)

Shanmukha Voggu
Shanmukha Voggu el 3 de Sept. de 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.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by