함수에 가변적인 입력 인수를 넣는 법
7 views (last 30 days)
Show older comments
사용자의 입력에 따라 셀형 배열을 만들고, 각 배열을 함수의 input으로 사용하고 싶습니다.
이때 배열 개수가 가변적이게 된다면 combinations에 입력을 어떻게 처리해야할지 문의드립니다...
signal_input{1} = [1];
signal_input{2} = [2,3];
signal_input{3} = [4,5,6];
signal_input{4} = [7,8,9,0];
.
.
.
signal_input{n} = {n, n+1...};
signal_comb = combinations(signal_input{1}, signal_input{2}, ..., signal_input{n}); //가변적인 n개의 배열을 함수 인수로 넣고싶습니다.
0 Comments
Accepted Answer
lazymatlab
on 21 May 2024
셀 배열에 대해서 {:}를 사용하면 comma separated list가 생성됩니다. 이것을 함수의 입력인자로 넣으면 됩니다.
c{1} = [1];
c{2} = [1, 2];
c{3} = [1, 2, 3];
combinations(c{:})
0 Comments
More Answers (0)
See Also
Categories
Find more on Matrix Indexing 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!