how many input parameters to the pass function

2 vues (au cours des 30 derniers jours)
pipor
pipor le 7 Sep 2023
Modifié(e) : Matt J le 7 Sep 2023
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?

Réponse acceptée

Matt J
Matt J le 7 Sep 2023
Modifié(e) : Matt J le 7 Sep 2023
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 commentaire
pipor
pipor le 7 Sep 2023
Modifié(e) : Matt J le 7 Sep 2023
I didn't think it could be done... thanks

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by