. 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