What is the output of the following command? [code]function mad= rush(p,varargin) disp(p) wish=cos(varargin[0]) end p=rush(1:3,pi/2)[/code]

What is the output of the following command?
Code:
function mad= rush(p,varargin)
disp(p)
wish=cos(varargin[0])
end
p=rush(1:3,pi/2)
A. Error due to element index
B. Error due to syntax of varargin
C.
1 2 3
wish=0
D. Error due to disp()
 
Answer: b
Explanation: The first error MATLAB finds is that the index of the element of the varargin array is given within []. This creates the error and MATLAB returns the first error it invokes The next error is the fact that there are no elements in varargin whose index number is 0.
 

Tìm kiếm

Back
Top