Faq how to export PCA PLS PCR predictions or scores to a text file or another program

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Issue:

How do I export PCA, PLS or PCR predictions or scores to a text file or another program?

Possible Solutions:

Copy and Paste into a program (PLS_Toolbox Version 3.5 and later, All Solo versions):

If you are working in the Analysis GUI, you can extract any value displayed in figure controlled by the Plot Controls. After plotting the data you wish to copy, simply select Edit/Copy Plotted Data in the Plot Controls to copy the plotted data to the system clipboard. You can then go to the target program (MS Excel, Text editor, etc.) and paste the information from the clipboard (see the instructions for the target program for information on pasting and manipulating the data).

You can also view a table of the specific data by selecting the View/Table menu in the Plot Controls.

Write from Matlab to a text file (PLS_Toolbox only - all Versions):

If you are working in the REGRESSION GUI, you should first save the model to the Matlab workspace using the File/Save Model command from the main REGRESSION GUI window. The following description assumes you have given it the name "modl" but any name will work.

Next, you'll have to extract the predicted y-values 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 predicted values are stored in the "pred" field of the model. You can get at them by doing something like this:

>> pred = modl.pred{2}; 

The number 2 tells Matlab that you want the y-block predictions. Finally, to save these to a text file you would use the command:

>> save pred.txt pred /ascii 

Where pred is the variable you created when extracting the values (above). The pred.txt file can be imported into Excel and will turn into m rows by n columns where ,n is the number of y-values predicted and m is the number of samples.


Still having problems? Please contact our helpdesk at helpdesk@eigenvector.com