Renaming function so that its shorter?

I have a function in which i use this code to call when needed;
[AUM_END] = power(AUM, AUM0, D100, FS, BLOCKM, DRAT, RHO, VTM, AM,...
AMUCD, KIM, NM, CM, RM, CD0M, BLOCKT, LBOOM, VTT, AT, KIT, NT, RT,...
CD0T, CT, PAUX, TRLF, NENG, AEF, PRAT, TRAT,
BEF, FUSED, FUSED0, TLEG);
As you can see, thats extremely long and takes up a lot of room when i need to call 9 times.. is there a way I can call this exact function using a different name?
I've tried activiating the function using only 'power'and '[AUM_END]', but in doing so MATLAB says there is not enough input arguments.
This is a function within a script.
Thanks.

4 comentarios

Walter Roberson
Walter Roberson el 19 de Abr. de 2021
Which (if any) of the parameters you use are exactly the same value for all 9 calls?
Matt J
Matt J el 19 de Abr. de 2021
Editada: Matt J el 19 de Abr. de 2021
Why so many input arguments? Are these scalar quantities? Could they be bundled into a vector or a struct?
Note also that "power" is an inadvisable choice for a function name to begin with, since it is the name of an existing built-in Matlab function (and one that can create many problems if over-riden).
Bob Wake
Bob Wake el 19 de Abr. de 2021
there are only 7 variables which change when the script is called, the rest are all the same.. should i make the variables which don't change, global?
If yes, do I define them at the start of the script as global, as well as in the function?
Adam Danz
Adam Danz el 19 de Abr. de 2021
No, don't use global variables.
You can condense the inputs into an array or structure.

Iniciar sesión para comentar.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 19 de Abr. de 2021

0 votos

https://www.mathworks.com/help/matlab/math/parameterizing-functions.html

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Productos

Preguntada:

el 19 de Abr. de 2021

Comentada:

el 19 de Abr. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by