5

I have the following table:

\begin{filecontents}{table.dat}
a   0.70
b   0.58
\end{filecontents}

and I am trying to access at the elements with the command \pgfplotstablegetelem{0}{0}\of\table but I obtain only the following error:

! Package pgfplots Error: Sorry, could not retrieve column '0' from table 'table.dat'. Please check spelling (or introduce name aliases)..

I know that the problem is with the letter, because the error disappear if in the table there are only numerical values.

  • use header=false when reading the table. Otherwise we have to see how you coded . – percusse Aug 24 '15 at 15:40
  • 1
    @percusse You should write an answer :) – Gonzalo Medina Aug 24 '15 at 16:16
5

If you don't have headers, then you should dispatch that during the table reading. Then you can use the [index] notation for unnamed columns. Otherwise, the parser thinks that there is a column named 0.

\documentclass{article}
\usepackage{pgfplotstable}
\begin{document}
\pgfplotstableread[header=false]{
a   0.70
b   0.58
}\mytable
\pgfplotstablegetelem{0}{[index]0}\of\mytable
\pgfplotsretval
\end{document}

gives a as the result.

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.