JohnDoe
JohnDoe

Reputation: 915

Create table from variables with original data sizes

I have a list of variables and its values which are of different datatypes (float32, uint32, int8 ....). Now I'm collecting them into a table:

T = [variable;variable2;variable3;variable4];

The variables in the tables are automatically casted to uint16. I would like to have the values in the original size. How can I say this to matlab when collecting the data to the table?

Upvotes: 0

Views: 137

Answers (1)

OmG
OmG

Reputation: 18838

You can use from table in matlab. For example:

T = table(categorical({'M';'F';'M'}),[45;32;34],...
{'NY';'CA';'MA'},logical([1;0;0]),...
'VariableNames',{'Gender' 'Age' 'State' 'Vote'});

Follow more details from documentation on table data structure.

Upvotes: 1

Related Questions