how many input parameters to the pass function

function CalcolaButtonPushed(app, event)
app.EquityUnfilteredCheckBox.Value
app.EquityFilteredCheckBox.Value
call function (app.EquityUnfilteredCheckBox.Value,app.EquityFilteredCheckBox.Value,..
end
hi, i want to call function with a lot of parameter (app.EquityUnfilteredCheckBox.Value...)
if I write them all in the function input with app.XXX it becomes a very long line.. is there a better way to pass them to it?

 채택된 답변

Matt J
Matt J 2023년 9월 7일
편집: Matt J 2023년 9월 7일
Why not just pass the entire app object?
function CalcolaButtonPushed(app, event)
app.EquityUnfilteredCheckBox.Value
app.EquityFilteredCheckBox.Value
%callfunction(app.EquityUnfilteredCheckBox.Value,app.EquityFilteredCheckBox.Value,...)
callfunction(app)
end
Just because the entire object app carries more data than callfunction() might need doesn't mean callfunction() needs to use it all.

댓글 수: 1

pipor
pipor 2023년 9월 7일
편집: Matt J 2023년 9월 7일
I didn't think it could be done... thanks

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

질문:

2023년 9월 7일

편집:

2023년 9월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by