.png)
Recebo um código de @egreg que cria linhas em arquivos de texto substituídos em um loop.
Preciso juntar todas essas linhas em 1 pgfplotstable, isso 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!
Como devo colocar o comando pgfplotstablevertcat?
Observe que, para meu algoritmo principal, preciso cobrar o conteúdo das linhas anteriores nas linhas subsequentes. Eu deixaria, portanto, pela primeira vez neste elaborado método de saída. O código principal posterior pode ser discutido e simplificado posteriormente.
\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}
Responder1
Funciona da mesma maneira:
\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}