MATLAB: Converting table to matrix

matrix

I have a 50×8 table that I imported from excel using readtable and now I need it into matrix form so I can plot the data a certain way
How can I convert the data to a matrix?
I have tried both these ways and it is not working
T1_selected{:,:};
A1=table2array(T1_selected);

Best Answer

" from excel using readtable and now I need it into matrix form so I can plot the data a certain way "
More than likely that is not so; plot and many of its friends are datetime and table aware so you simply refer to the data out of the table you already have to plot or otherwise use it.
Even more to the point, you can't create an array out of a mix of different variable types as the error message says:
Unable to concatenate the specified table variables.
Caused by:
Error using datetime/horzcat (line 1334)
All inputs must be datetimes or date/time character vectors or date/time strings.
That's the advantage of tables; they can handle disparate data types as a group while arrays must be wholly of one class (excepting cell arrays which are useful but not needed here and would just compound the dereferencing).
As another said, we're lacking sufficient information to provide specific code, but just do something like
plot(T1.Date,T1.YourDataVarName)
where T1, YourDataVarName are the appropriate table variable name and whatever variable it is in the table you wish plotted vs time. Magic will happen...
Read the sections on tables and how to dereference them--there are a number of alternatives depending on the objectives at hand.
Related Question