MATLAB: How to ask for a workspace variable input in a running program

inputvariable

I'd like to be able to set a variable in a code to a workspace variable that the user can choose.
Assume I have some variable B in the workspace A=input('Please pick the variable you would like to use… ');
How do I set A equal to B while the program is running?

Best Answer

A simple answer is uigetvar , posted on the file exchange.
It pops up a dialog box, listing the names of all variables in your base workspace. You select the desired variable, and it returns the contents of that variable to your function of script.
Related Question