[pstricks] using values read from an external file

Herbert Voss Herbert.Voss at FU-Berlin.DE
Thu Apr 12 20:18:14 CEST 2012


Am 12.04.2012 14:04, schrieb Leon Free:

> As an example, I tried doing something similar to 2 (but more complex
> because the a[i] are generated by an external program and read by latex
> "on the fly"). Here is my exemple (needs scilab to be run). It does what
> I want, but it's really hugly. Compiles with --shell-escape option.

you can read the value with \readdata and then extend it
with an \edef. The delimiter of the data values is the
character D:

documentclass{article}
\usepackage{multido,pst-plot,fancyvrb}
\begin{document}
%% macro for executing scilab from within latex
\newcommand\scilab[1]{\write18{scilab -nogui -f #1}}

\begin{VerbatimOut}{scilab.tex}
q=fscanfMat('q.tex');
a=1-cdfnor("PQ",q,0,1);
fprintfMat('leftcdf',a);
quit;
\end{VerbatimOut}
%
\newwrite\tempfile

\multido{\rA=0.05+0.50}{4}{%
   \immediate\openout\tempfile=q
   \immediate\write\tempfile{\rA}
   \immediate\closeout\tempfile
% scilab execution
  \scilab{scilab.tex}
%
   \readdata\data{leftcdf}
%
   \edef\data{\data\space D 1 D \rA\space D 1 }
   \begin{pspicture}(-5,5)
   $\alpha = $ \input{leftcdf} \rA
   \listplot{\data}
   \end{pspicture}
   \newpage%
}
\end{document}


Herbert


More information about the PSTricks mailing list