My next question follows on Sum up rows from different data files where I asked how to sum up the data from different files.
In this case I have e.g. two data files, consisting of m (here e.g. m=3) columns and a fixed number of rows n (here e.g. n=3), seperated by a semicolon (see minimal example):
What I want to plot in a tikzpicture is an elementwise division, e.g
Yvalues(1)=D1(1,2)/D2(1,3)
Yvalues(2)=D1(2,2)/D2(2,3)
Yvalues(3)=D1(3,2)/D2(3,3)
... for all n rows
The Xvalues shoud be the first column of one of the two loaded files (they are the same).
Maybe someone can use the defined makro 'mergetables' from the link above. Maybe the document could look something like this:
\documentclass{article}
\usepackage{pgfplots, pgfplotstable}
\usepackage{filecontents}
\begin{filecontents}{D1.txt}
0.1;10;10
0.2;20;12
0.3;30;14
\end{filecontents}
\begin{filecontents}{D2.txt}
0.1;3;5
0.2;3.5;10
0.3;4;15
\end{filecontents}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot [Xvalues=first column of any file (D1 or D2),
Yvalues= e.g. 2nd column of file D1 devided by 3rd column of file D2]
\end{axis}
\end{tikzpicture}
\end{document}
edit:
My problem is to access to the single columns of each loaded file. In my oppinion the new command, lets call it again \mergetables, should look something like:
\mergetables{D1}{0,1}{D2}{2}..{Di}{col1,col2}{\datatable}
This command should create a new table \datatable with the first column D1(0), the second column D1(1) and the third column D2(2) seperated by a semicolon. Maybe each column of the new \datatable should have a columnname X,Y1,Y2,... so when I want to plot them I can call them using their columnames like:
\addplot table [x=X, y expr={Y1./Y2}] {\datatable};
\documentclass)? It's not a whole lot of fun to piece something together, so it would be good if you could do that work to make it easier for others to try and help you. – Jake Feb 1 at 12:30