read function intputs into cell array
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
I have script calls functions like this:
func1('A1',[1],'min',0,'max',1)
func1('A2',[1],'min',0,'max',100)
...
func2('B1',[1],'min',0,'max',1)
func2('B2',[1],'min',0,'max',1)
...
I want to gather all these inputs into a list. How can I get the functions inputs as a cell array? I do not want to use regular expression, because the real situation is much more complex.
Thanks
댓글 수: 0
답변 (1개)
Shiva Kalyan Diwakaruni
2020년 3월 24일
Hi,
This is to my understanding that you want to get function inputs as a cell array instead of mentioning each arguments specifically inside function definition as below.
func1('A1',[1],'min',0,'max',1)
func1('A2',[1],'min',0,'max',100)
...
func2('B1',[1],'min',0,'max',1)
func2('B2',[1],'min',0,'max',1)
...
Func1(varargin)
Func1(varargin)
….
Func2(varargin)
Func2(varargin)
…..
Following can be used to declare a global cell array and add them into a global cell array by running a for loop through varargin inside every function.
Func1(varargin)
Global cell_array
For k = 1:numel(varagin)
Cell_array = [cell_array,varargin[k]]
For more information on varargin please visit the below link:
참고 항목
카테고리
Help Center 및 File Exchange에서 Cell Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!