MATLAB Answers

LO
0

how can I do PCA on a table ?

Asked by LO
on 30 May 2019
Latest activity Commented on by Star Strider
on 7 Jun 2019
I have a 3000 x 18 table containing 18 variables (one per column) of both numerical and categorical type (6 categorical).
I would liket to do PCA on the whole dataset
but the command
[coeff,score]=pca(mytable) does not work.
any idea on how to proceed ?

  0 Comments

Sign in to comment.

Tags

1 Answer

Answer by Star Strider
on 30 May 2019
 Accepted Answer

The pca function only accepts single-precision or double-precision numerical arrays. You most likely need to use the table2array (link) function first, to get the numeric data out of your table and into a form that pca can use.

  4 Comments

Show 1 older comment
Star Strider
on 7 Jun 2019
Unless you can extract just the numerical values, you cannot use the pca function.
LO
on 7 Jun 2019
Got it, thanks. I thought categorical PCA was also possible with MATLAB.
Perhaps the answer is no. I will try to then exclude the non numerical variables and see if it works !
Star Strider
on 7 Jun 2019
It should work in that instance.

Sign in to comment.