MATLAB: Read input matrix inside a function

inputMATLAB

I have a numerical array 'drop' setup in my Matlab workspace.
I can read the array into an interactive Matlab script using the prompt:
F = input(' Enter the matrix name: ')
This works fine in a main script.
However, when I place this same command inside a supporting function file called by the main script, I get the following error message upon execution:
??? Error using ==> input Undefined function or variable 'drop'
Please help. Thank you. Tom

Best Answer

This is to be expected. Anything you type in in response to an input() call that does not use the 's' option, will be evaluated in the workspace of the function that called input().
You could type in your response to input as
evalin('caller','drop')