I have a data.txt file and it contains an array of numbers, I included it in the preamble of the .tex file, now I would like to display some specific entry from the data file, not the whole data set but just some of them, how should I do?


1 Answer 1


You can use the PGFplotstable package, which is part of PGFplots, for this.

The data would be loaded into a table macro using \pgfplotstableread{data.txt}\datatable (there are various options for accommodating different data file variants), after which you can access an individual element using \pgfplotstablegetelem{<row>}{<column>}\of\datatable. The element will then be available as \pgfplotsretval.


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.