[Tex/LaTex] Multiple Files input to one pgfplotstable

pgfplotspgfplotstable

I have several data files that I would like to combine into one table using pgfplots table. Specifically, I would like to use one file to set the first three columns and then have each data file fill in another column after that (the first two columns are experimental parameters, consistent in every file). The files are tab delineated.

Can I set pgfplots up to do this, and if so, how? I've dug through the manual and tried using pgfplotscreatecolumn and createonuse but neither one seems to be suited to the task.

Best Answer

You can do this using the copy column from table option of the \pgfplotstablecreatecol command (see p. 39 of the pgfplotstable manual).

Given the two files

<dataA.dat>
4.1 .1 1.1       
3.2 .2 1.2
5.3 .3 1.3

<dataB.dat>
-1 0
2  1
4  -1

You can add the columns from to the first table like so:

\documentclass{article}

\usepackage{pgfplotstable}

\begin{document}
\pgfplotstableread{dataA.dat}\dataA
\pgfplotstableread{dataB.dat}\dataB

\pgfplotstablecreatecol[copy column from table={\dataB}{[index] 0}] {par1} {\dataA}
\pgfplotstablecreatecol[copy column from table={\dataB}{[index] 1}] {par2} {\dataA}

\pgfplotstabletypeset{\dataA}
\end{document}