Based on the famous example to create a new column containing the min/max/avg... value of one column, I was wondering how to compute the average value and then to use it as a float variable in a calculus ?

  • What do you want to do with the value? The sum of the values can be done via the example given on page 51 of pgfplotstable manual. You can also divide that value by the \pgfplotstablerow + 1 – percusse Jun 25 '15 at 11:50
  • Finally, I have solved part of the problem by myself... Here is the corresponding code. – Erwin Jun 26 '15 at 13:16
  • Great, you can answer your own question if you wish. – percusse Jun 26 '15 at 13:19
  • The aim was so to compute the maximum value of a column, and only one value, to finally use it in the text. The only problem there is the ugly "dataExternalA" used in the macro. I have not succeeded to dynamically the name of table as an argument – Erwin Jun 26 '15 at 13:26

The answer is posted by OP in the question.



1 5
2 3
-1 6
4 14
5 0
6 1


% Read


% Draw

\addplot[mark=none] table[x index = 0, y index = 1]{\tableA};

\addplot[mark=none] table[x = level, y = error1]{\tableB};

% Compute

\maxVal{[index] 0}
The maximum for the first column of tableA is: \pgfmathprintnumber{\buffer} 

The maximum for the column "error1" of the 'pgfplotstable.example1.dat' file is: \pgfmathprintnumber{\buffer}


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.