How can I use many input arguments(up to 20) to my function?
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (2개)
Youssef Khmou
2013년 5월 10일
편집: Youssef Khmou
2013년 5월 10일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Sensors and Transducers에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!