MATLAB: How to get all cell values from function

cell arrayMATLABmatlab function

suppose we have simple function like this
function testOutput= test(input)
testOutput = {ones(2,2),ones(3,3),ones(4,4)};
end
When i run this function –> test(1)
why it only returns 1×1 cell? not all values in the function? How to get all values as same as testOutput ?

Best Answer

Don't use input as the name of an argument because it's the name of a built in function that waits for your input by keyboard. Sine you're not even using it, just get rid of it.
This works:
t = test() % To call it.
% To define it:
function testOutput = test()
testOutput = {ones(2,2), ones(3,3), ones(4,4)};
end