[GAP Forum] Reading data?
dutour at liga.ens.fr
Fri Jul 30 08:04:11 BST 2004
On Thu, Jul 01, 2004 at 02:07:58PM +0200, Tim B wrote:
> Hi All,
> this should be a silly question: how do I read in
> some table of data? I have a file with what is essentially
> a matrix as space-separated integers, and I would like
> to get it into GAP as a matrix without having to manually
> place commas and square brackets in the file.
> This has to be easy, but I cannot find even the faintest
> shimmer of a way to make it happen - I cannot even see how
> to read an integer!
> Hope someone can help!
I am confronted with a similar problem very frequently.
The solution, which I am using, is to use perl script.
So, in your case the script would transform the file
1 2 3
4 5 6
into the file
which you can get in GAP by the command
If necessary I will write the script for you, the idea being
that every kind of file requires its own script.
Hope this help.
Mathieu Dutour Researcher in Math
Tel. (+972)2 65 84 103 and Computer Science
Fax. (+972)2 56 30 702 Einstein Institute of Mathematics
E-mail: Mathieu.Dutour at ens.fr Hebrew University of Jerusalem
More information about the Forum