MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply TodayTo resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016

Asked by Nopparat on 10 May 2013

I write my function which needs a lot of input arguments. For example, function my_function=test(input1,input2,input3,....input20)

This function can call only first 9 input arguments so I can't use input argument#10-20. So, please tell me how can I use these input in my function. Thank you very much

*No products are associated with this question.*

Answer by the cyclist on 10 May 2013

Variable-length input argument lists might solve your problem:

Answer by Youssef KHMOU on 10 May 2013

Edited by Youssef KHMOU on 10 May 2013

hi,

you can use a single input which is multidimensional , here is an example :

i want to compute the powers consumed by 9 different devices in the house based on the current, voltage and the alpha angle :

function Y=Myfunction(M)

Y(1)=M(1,1)*M(1,2)*cos(M(1,3)); Y(2)=M(2,1)*M(2,2)*cos(M(2,3)); ...... Y(9)=M(9,1)*M(9,2)*cos(M(9,3));

so the single input is ( as axample ):

M =

0.1622 0.7482 0.0782 0.7943 0.4505 0.4427 0.3112 0.0838 0.1067 0.5285 0.2290 0.9619 0.1656 0.9133 0.0046 0.6020 0.1524 0.7749 0.2630 0.8258 0.8173 0.6541 0.5383 0.8687 0.6892 0.9961 0.0844

## 0 Comments