I'm unaware of a Maxima function that reads data from a file and
places the elements into a list or matrix. I'm assuming that the
motivation is to import data from a spreadsheet or some
other application.
I can think of two approaches:
(1) Define functions for reading a matrix, a list, and an array.
The read_matrix function would read a line of the file and place all
these elements in a matrix row; read_list would read elements and place
them
in a list (ignoring end of lines); read_array would be similar
to read_matrix --- it would only work for one or two dimensional arrays.
(2) Define one function that reads items from a file and places each
item into a list. Then define a utility that converts a list to a
matrix (either row-by-row or column-by-column, the user gets to choose)
or an array.
What do you all think? I suppose (1) might be better for reading matrices
because the user doesn't need to know the matrix size (it's determined by
how many elements are in each line). Or is there a Maxima function(s)
that does these things already?
Barton
P.S. I see that yesterday I used cvs when I meant csv. Funny.
Milan Lukic <lmilan@shell.core.com>
Sent by: maxima-admin@math.utexas.edu
09/09/2003 11:31 AM
Please respond to Milan Lukic
To: maxima@www.ma.utexas.edu
cc:
Subject: Re: [Maxima] saving as CSV, eigensystem
e-mail from the Maxima list). I am also wondering if we could read a
data file into maxima, probably forming a matrix or an array. Say, you
have a file data.txt such as
1 2 3
4 5 6
7 8 9
....
Milan Lukic
_______________________________________________
Maxima mailing list
Maxima@www.math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima