i working with MATLAB and i have a problem with the varargin input.
My target is to input another matrix with a (x,2) dimension. I want to check the correct size.
Now i coded this, but it does not work. My first aim was only access to the input varargin matrix, but this does not work.
if nargin > 0
intervalle = varargin(1);
else
intervalle = [0,2.5 ; 2.5,5 ; 0,2 ; 2,4 ; 4,6 ; 3,5 ; 5,7 ; 7,9 ; 9,11 ; 11,13 ;];
end
Can you give me a tip for solving my problem?
Thanks
I believe that varargin
is a cell array. Also, if you have other arguments, you should use length(varargin)
instead of nargin
. Try something like this:
if length(varargin) > 0
intervalle = varargin{1};
else
intervalle = [0,2.5 ; 2.5,5 ; 0,2 ; 2,4 ; 4,6 ; 3,5 ; 5,7 ; 7,9 ; 9,11 ; 11,13 ;];
end
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.