Whether there is a faster way depends on your file names and column names. You could at least define a macro that saves typing of options that are the same for each column. If your columnnames are the same in each file you could use a
\foreach
-loop, from package pgffor, to loop over a list of files, and the list of columns in each file. If the columnnames in all files are unique you could write a loop for each file.
To clarify, first an example with identical column names in all files:
Code: Select all
%% Copy column takes 4 arguments: input table, input column, output table, output column
\newcommand{\copycolumn}[4]{
\pgfplotstablecreatecol[
create col/copy column from table={#1}{#2}
]{#4}{#3}
}
\pgfplotstableread{file1.dat}\datafile
% provide filenames without ".dat"
\foreach \file in {file2, file3, file4}{
\foreach \column in {column1, column2, column3}{
\copycolumn{\file.dat}{\column}{\datafile}{\file\column} % make sure column names are unique in output
}
};
If the columnnames are unique across all files, or the number of columns in each file is not the same, you could do something like this:
Code: Select all
%% Copy column takes 3 arguments: column, input table, output table
\newcommand{\copycolumn}[3]{
\pgfplotstablecreatecol[
create col/copy column from table={#2}{#1}
]{#1}{#3}
}
\pgfplotstableread{file1.dat}\datafile
\foreach \column in {column1, column2, column3}{
\copycolumn{\column}{file2.dat}{\datafile}
};
\foreach \column in {column4, column5, column6, column7}{
\copycolumn{\column}{file3.dat}{\datafile}
};
\foreach \column in {column8, column9}{
\copycolumn{\column}{file4.dat}{\datafile}
};
Ubuntu 13.10 + Tex Live 2013 + Texmaker / Windows 7 Pro + MikTex 2.9 + TexnicCenter / Android 4.3 + TexPortal + DroidEdit