Faq export PCA scores and loadings to text file

Issue:

How do I export PCA scores and loadings to a text file (to read into MS Excel, for example)?

Possible Solutions:

If you are working in the Analysis GUI, you should first save the model to the Matlab workspace. The following description assumes you have given it the name "modl" but any name will work.

Next, you'll have to extract the scores and loadings from the model and save them to a text file. The whole model is stored in a structure (which is just a container for all the variables of the model. These other variables are called "fields" of the structure). The scores and loadings are stored in the "loads" field of the model. You can get at the scores doing something like this:

>> myscores = modl.loads{1};

and likewise:

>> myloadings = modl.loads{2};

Finally, to save each of these to a text file you would use the commands:

>> save scores.txt myscores /ascii

>> save loadings.txt myloadings /ascii

Where myscores and myloadings are the variables you created when extracting the loadings and scores (above). Each will turn out to be m rows by n columns in Excel where "n" is the number of PCs you had in your model and "m" is either the number of samples (for scores) or number of variables (for loadings).

Option 2: (**For use within Solo or to avoid use of the command line**) You can also access the scores by bringing up a Scores plot (click on the scores button in the Analysis GUI) and, in the Plot Controls, select File/Edit Data (or File/Open in Editor in older versions of Solo and PLS_Toolbox). This will open the scores in a DataSet Editor. You can then select File/Export To/Comma Separated Values.