[pstricks] Accessing data in files on disk

Herbert Voss Herbert.Voss at alumni.TU-Berlin.DE
Fri Apr 25 12:10:13 CEST 2003


Denis Girou schrieb:

> PostScript. What \readdata do is to concatenate in a macro the coordinates,
> suppressing the original delimiters and introducing a "D" Postscript operator
> before each of them. For instance, with the "data.dat" file that I use for my
> tests here, the macro resulting of \readdata will contain:
>  D 1.2 D 2.3 D 2.7 D -1.1 D 2 D 2 D 4.5 D 0.7539 D 1.7 D 3.9 D 1 D 4.6 D 
> -0.43 D 3 D 3.98 D -0.7 D -0.7 D -0.4

I tried to use this for a 3D plot, but I failed.
With the following example I get for the first
coordinates

New point: (1.2,2.3,1)
 > \Data=macro:
->D 1.2 D 2.3 D 1.4 D 2.7 D -1.1 D -2.
l.20 \show\Data

I do not understand, why the 1.4 is cut

Herbert



\documentclass[a4paper]{article}
\usepackage{pst-plot}

\makeatletter
\def\GetCoordinates#1{\expandafter\GetCoordinates at i#1}
\def\GetCoordinates at i #1{\GetCoordinates at ii#1}
\def\GetCoordinates at ii#1 #2 #3 #4 #5 #6{%
	\DoCoordinate{#2}{#4}{#6}%
	\@ifnextchar D{\GetCoordinates at ii}{}%
}
\makeatother

\pagestyle{empty}
\begin{document}
%\readdata{\Data}{data3D.dat}
\def\Data{D 1.2 D 2.3 D 1.4 D 2.7 D -1.1 D -2}% only for demo

\def\DoCoordinate#1#2#3{\typeout{New point: (#1,#2,#3)}}
\GetCoordinates{\Data}

\show\Data

\end{document}



More information about the PSTricks mailing list