[pstricks] using values read from an external file

Herbert Voss Herbert.Voss at FU-Berlin.DE
Sat Apr 14 18:50:06 CEST 2012


Am 14.04.2012 10:13, schrieb Leon Free:

>> How many elements are saved in the \data macro?
>>
>
> The data is produced by scilab (or similar). If the data is generated
> before running any latex compile, it is a 91x1 matrix. Now if scilab is
> called during the latex process (as in the example I provided), \data
> contains a single value.

in this case read it this way:

\RequirePackage{filecontents}% allows overwriting
\begin{filecontents*}{test.data}
0.123456789
\end{filecontents*}

\documentclass{article}
\usepackage{pst-plot}
\makeatletter
\def\getValue#1{\expandafter\get at Value\data\@nil}
\def\get at Value#1 #2 #3\@nil{%
\def\Value{#3}}

\begin{document}

\readdata\data{test.data}
\getValue{\data}
\Value

\end{document}

Herbert


More information about the PSTricks mailing list