.png)
Obtengo un código de @egreg que crea filas en archivos de texto escritos en un bucle.
Necesito juntar todas estas filas en 1 pgfplotstable, eso significa algo como
\ifnum\the\filecount=1 \pgfplotstableread[col sep=comma]{data\the\filecount.txt}{\main}\else
\pgfplotstableread[col sep=comma]{data\the\filecount.txt}{\temp}
% \pgfplotstablevertcat{\main}{\temp} % <--- Does not work!
¿Cómo tengo que colocar el comando pgfplotstablevertcat?
Tenga en cuenta que para mi algoritmo principal, tengo que cargar el contenido de las filas anteriores en las filas siguientes. Por lo tanto, lo dejaría por primera vez en este elaborado método de salida. El código principal posterior se puede analizar y simplificar más adelante.
\documentclass[a4paper]{article}
\usepackage{pgfplotstable}
\newcount\filecount
\newwrite\cisout
\begin{document}
\filecount=1
\def\aaa{file number \the\filecount}%
\loop
\immediate\openout\cisout=data\the\filecount.txt
\immediate\write\cisout{%
111, 222, \aaa
}
\immediate\closeout\cisout
\ifnum\the\filecount=1 \pgfplotstableread[col sep=comma]{data\the\filecount.txt}{\main}\else
\pgfplotstableread[col sep=comma]{data\the\filecount.txt}{\temp}
% \pgfplotstablevertcat{\main}{\temp} % <--- Does not work!
\fi
\advance\filecount by 1
\ifnum\filecount<5
\repeat
\section{The Main Table is incomplete}
\pgfplotstabletypeset[col sep=comma, string type]{\main}
\section{The last Temp-Table}
\pgfplotstabletypeset[col sep=comma, string type]{\temp}
\section{Input Test}
\input{data1.txt} \\
\input{data2.txt}\\
\input{data3.txt}\\
\input{data4.txt}
\end{document}
Respuesta1
Funciona igual de esta manera:
\documentclass[a4paper]{article}
\usepackage{pgfplotstable}
\pgfplotstableset{string type}
\newcount\filecount
\newwrite\cisout
\begin{document}
\filecount=1
\def\aaa{\the\filecount}%
\loop
\immediate\openout\cisout=data\the\filecount.txt
\immediate\write\cisout{%
111, 222, \aaa
}
\immediate\closeout\cisout
\ifnum\the\filecount=1 \pgfplotstableread[col sep=comma, string type]{data\the\filecount.txt}{\main}%
\else \pgfplotstableread[col sep=comma, string type]{data\the\filecount.txt}{\temp}%
\pgfplotstablevertcat{\main}{\temp}% <--- Does work!
\fi%
\advance\filecount by 1
\ifnum\filecount<5
\repeat
\section{The Main Table is incomplete}
\pgfplotstabletypeset[col sep=comma, string type]{\main}
\section{The last Temp-Table}
\pgfplotstabletypeset[col sep=comma, string type]{\temp}
\section{Input Test}
\input{data1.txt} \\
\input{data2.txt}\\
\input{data3.txt}\\
\input{data4.txt}
\end{document}