How can I use many input arguments(up to 20) to my function?
2 views (last 30 days)
Show older comments
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
0 Comments
Answers (2)
the cyclist
on 10 May 2013
Variable-length input argument lists might solve your problem:
0 Comments
Youssef Khmou
on 10 May 2013
Edited: 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
See Also
Categories
Find more on Sensors and Transducers in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!