How to perform PCA in Matlab when number of dimensions is larger than number of observations? I have a data matrix of say, $3000 \times 200$, i.e. I have $3000$-dimensional observations from $200$ subjects. How can I reduce the dimensionality to $1000$ in MATLAB?
With bigger numbers, princomp() function causes an out of memory error.
I tried princomp(data, 'econ'); but it only returns a $199$-by-$199$ matrix, so am I limited to the number of observations?
I would appreciate an example of how to get the reduced data, if possible.
 A: First, function princomp is deprecated, you should use pca instead.
Second, as @ttnphns said, if you only have $200$ subjects, then there is no way you can get $1000$ principal components; maximum number is $199$. See here for an explanation: Why are there only $n-1$ principal components for $n$ data points if the number of dimensions is larger or equal than $n$?
Third, as @Aksakal wrote, Matlab's pca assumes that rows in the data matrix correspond to samples, not variables. So you need to transpose your matrix.
Having all of that in mind, here is the code:
X = randn(3000,200);
[eigenvectors, PCs, eigenvalues] = pca(X');

%// eigenvalues is an array of length 199

A: It appears that you are not calling pca function properly. Your array's must be X(200,3000), while you provide X(3000,200).
This is from the description of princom function:

the n-by-p data matrix X, and returns the principal component
  coefficients, also known as loadings. Rows of X correspond to
  observations, columns to variables.

It seems that you mixed up the rows and the columns of your input matrix.
