What is the output of the following command? [code]function wish= ful(p,varargin) celldisp(p) wish=sin(varargin{1}) end p=ful(1:3) [/code]

What is the output of the following command?
Code:
function wish= ful(p,varargin)
celldisp(p)
wish=sin(varargin{1})
end
p=ful(1:3)
A. Error in calling the function
B. Error in celldisp
C. Error in the function definiton
D. Error in the wish variable
 
Answer: b
Explanation: p is treated to a function which takes inputs as cellular arrays. In the above code, if the input to the ful command was {1:3}, the output would have been
p{1}= 1 2 3
Hence, the error is in using celldisp command, only disp command is to be used.
 

Tìm kiếm

Back
Top