[pstricks] using values read from an external file

Leon Free leon.free at free.fr
Fri Apr 13 14:46:38 CEST 2012


Thanks for your suggestion. It works fine with the example I provided.

Your trick shows it is possible to concatenate the \data list with other
arbitrary values as you do in

\edef\data{\data\space D 1 D \rA\space D 1 }

but what about the "inverse" operation of extracting an element (the \iA
th) from \data and store it in a tex variable? is there a simple way to
do that with a tex macro? or is it better/simpler to have an external
script doing that job (and then opening/reading the result with latex)?



Le 12/04/2012 20:18, Herbert Voss a écrit :
> 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
> _______________________________________________
> PSTricks mailing list
> PSTricks at tug.org
> http://tug.org/mailman/listinfo/pstricks
> archive: http://www.tug.org/pipermail/pstricks/



More information about the PSTricks mailing list