TransWikia.com

newwrite, pgfplotstable: Put generated rows together to one pgfplotstable (follow-up question)

TeX - LaTeX Asked on October 23, 2020

I get a Code from @egreg that create rows in outwritten textfiles in a loop.
I need to put all these rows together in 1 pgfplotstable, that means something like

ifnumthefilecount=1 pgfplotstableread[col sep=comma]{datathefilecount.txt}{main}else 
pgfplotstableread[col sep=comma]{datathefilecount.txt}{temp}
% pgfplotstablevertcat{main}{temp}  % <--- Does not work!

How do I have to place the pgfplotstablevertcat-command?

Note that for my main algorithm, I have to charge contents of the preceding rows in subsequent rows. I would therefore leave it for the first time in this elaborate output method. The later main code may be discussed and simplified later.

enter image description here

documentclass[a4paper]{article}
usepackage{pgfplotstable}

newcountfilecount
newwritecisout
begin{document}

filecount=1
defaaa{file number thefilecount}%
loop
immediateopenoutcisout=datathefilecount.txt
immediatewritecisout{%
111, 222,   aaa
}
immediatecloseoutcisout
ifnumthefilecount=1 pgfplotstableread[col sep=comma]{datathefilecount.txt}{main}else 
pgfplotstableread[col sep=comma]{datathefilecount.txt}{temp}
% pgfplotstablevertcat{main}{temp}  % <--- Does not work!
fi
advancefilecount by 1
ifnumfilecount<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}

One Answer

It works alike this way:

documentclass[a4paper]{article}
usepackage{pgfplotstable}

pgfplotstableset{string type}

newcountfilecount
newwritecisout
begin{document}

filecount=1
defaaa{thefilecount}%
loop
immediateopenoutcisout=datathefilecount.txt
immediatewritecisout{%
111, 222,  aaa
}
immediatecloseoutcisout
ifnumthefilecount=1 pgfplotstableread[col sep=comma, string type]{datathefilecount.txt}{main}%
else pgfplotstableread[col sep=comma, string type]{datathefilecount.txt}{temp}%
pgfplotstablevertcat{main}{temp}% <--- Does  work!
fi%
advancefilecount by 1
ifnumfilecount<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}

Answered by cis on October 23, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP