Dimension reduction using PCA in Matlab I have a $152 \times 27578$ matrix, $152$ samples and $27578$ features, and I used the PCA function for the dimension reduction in Matlab.
X = load(dataset);
coeff = pca(X);

It generated a $27578 \times 151$ matrix. But I don't understand what exactly it is generating and I am unable to understand what to do next. Can any one help me with the understanding? My main goal is to reduce the dimension of my original matrix.
 A: If you type help pca you will see loads of information about the function.
If you only output one argument, it will return the principal coefficients, sometimes called the loadings. The $27578\times151$ matrix you received contains the first loading in the first row, the second in the second row and so on.
If you ask for two outputs, you obtain
[V, U] = pca(X);

where V contains the loadings and U the score values. You reconstruct the input data by U*V'.
In order to perform dimensionality reduction, you must select the first n components of both matrices as U(:, 1:n) and V(:, 1:n) and perform the approximated reconstruction as U(:, 1:n)*V(:, 1:n)'.
A: The output of PCA is a matrix of your principle components. So, this matrix contains a set of new signals but now these components are ordered in terms of how much of the datasets variance they capture. The first principle component in the matrix coeff(1,:) describes the most variance to the last component coeff(27578,:) which captures the least. So you simply need to choose $k$ dimensions you want to reduce your new inputs to like so coeff(1:k,:)
One method suggested here would be to select the first $k$ components that still captures 99% of the variance of your dataset. Thus you would have reduced dimension inputs but still describe your data well.
