MATLAB: How do we take user’s input for table name and column name and then extract corresponding values from the table

MATLABtable

How do we take user's input for table name and column name and then extract corresponding values from the table?

Best Answer

Please refer to the following example script. It asks users to input table name and column name. Then it takes out the column based on the input.
load patients
T = table(Gender,Smoker,Height,Weight);
TableName = input('table name:');
ColumnName = input('column name:', 's');
TableName.(ColumnName)