RE : reading a matrix from file




> -----Message d'origine-----
> De?: maxima-bounces at math.utexas.edu [mailto:maxima-bounces at math.utexas.edu] De la part de
> Robert Gloeckner
> Envoy??: jeudi 16 novembre 2006 22:51
> ??: maxima at math.utexas.edu
> Objet?: [Maxima] reading a matrix from file
> 
> ** Reply Requested When Convenient **
> 
> Hello,
> I try to read a matrix from a file.
> maxima_60.html#SEC212 says:
> 
> Function: read_matrix (file_name)
> Reads the file file_name and returns its entire content as a matrix. If separator_flag is not
> specified, the file is assumed space-delimited.
> 
> so i tried:
> 
> load(numericalio);
> read_matrix('d:/Robert/dki/001-Projekte/00_pvT/Versuche/WLF/WLF-all-const-pressure-multivar-
> matrix.txt');
> 
> 
> this is a part of the file:
>  280 0  0 0.251
>  260 0  0 0.237
>  240 0  0 0.231
>  220 0  0 0.229
>  200 0  0 0.236
>  180 0  0 0.232
>  160 0  0 0.227
>  140 0  0 0.228
>  120 0  0 0.231
> 

I have tested this sample and it work fine. May be you have a typo in your text file.
I saw some typos in your previous message. You have "!" characters at some point
And also some values are written like this:
 0. 251
Note the white-space between the "." and the "2";
One other way to avoid the limit of the numbers of argument to matrix function is to use
Addrow like this:

m : matrix ( [280, 0, 0, 0.251],  [260, 0, 0, 0.237],  [240, 0, 0, 0.231],  [220, 0, 0, 0.229],
[200, 0, 0, 0.236],  [180, 0, 0, 0.232],  [160, 0, 0, 0.227],  [140, 0, 0, 0.228],  [120, 0, 0,
0.231],  [100, 0, 0, 0.227])$
m : addrow(m,  [80, 0, 0, 0.224],  [60, 0, 0, 0.219],  [40, 0, 0, 0.237],  [280, 0, 2, 0.255],
[260, 0, 2, 0.245],  [240, 0, 2, 0.239],  [220, 0, 2, 0.244],  [200, 0, 2, 0.246],  [180, 0, 2,
0.234],  [160, 0, 2, 0.234])$
m : addrow(m,  [140, 0, 2, 0.233],  [120, 0, 2, 0.227],  [100, 0, 2, 0.220],  [80, 0, 2,
0.217],  [60, 0, 2, 0.217],  [40, 0, 2, 0.230],  [280, 0, 4, 0.264],  [260, 0, 4, 0.243],
[240, 0, 4, 0.237],  [220, 0, 4, 0.244])$
m : addrow(m,  [200, 0, 4, 0.248],  [180, 0, 4, 0.240],  [160, 0, 4, 0.237],  [140, 0, 4,
0.231],  [120, 0, 4, 0.227],  [100, 0, 4, 0.229],  [80, 0, 4, 0.227],  [60, 0, 4, 0.219],  [40,
0, 4, 0.241],  [280, 0, 8, 0.265])$
m : addrow(m,  [260, 0, 8, 0.251],  [240, 0, 8, 0.244],  [220, 0, 8, 0.248],  [200, 0, 8,
0.256],  [180, 0, 8, 0.243],  [160, 0, 8, 0.241],  [140, 0, 8, 0.236],  [120, 0, 8, 0.231],
[100, 0, 8, 0.225],  [80, 0, 8, 0.218])$
m : addrow(m,  [60, 0, 8, 0.214],  [40, 0, 8, 0.233],  [280, 7, 0, 0.254],  [260, 7, 0, 0.243],
[240, 7, 0, 0.239],  [220, 7, 0, 0.242],  [200, 7, 0, 0.245],  [180, 7, 0, 0.244],  [160, 7, 0,
0.240],  [140, 7, 0, 0.239])$
m : addrow(m,  [120, 7, 0, 0.234],  [100, 7, 0, 0.238],  [80, 7, 0, 0.229],  [60, 7, 0, 0.230],
[40, 7, 0, 0.249],  [280, 7, 2, 0.257],  [260, 7, 2, 0.248],  [240, 7, 2, 0.240],  [220, 7, 2,
0.254],  [200, 7, 2, 0.249])$
m : addrow(m,  [180, 7, 2, 0.239], [160, 7, 2, 0.237],  [140, 7, 2, 0.229],  [120, 7, 2,
0.224],  [100, 7, 2, 0.224],  [80, 7, 2, 0.222],  [60, 7, 2, 0.231],  [40, 7, 2, 0.250],  [280,
7, 4, 0.268],  [260, 7, 4, 0.252])$
m : addrow(m,  [240, 7, 4, 0.246],  [220, 7, 4, 0.250],  [200, 7, 4, 0.256],  [180, 7, 4,
0.244],  [160, 7, 4, 0.243],  [140, 7, 4, 0.239],  [120, 7, 4, 0.231],  [100, 7, 4, 0.224],
[80, 7, 4, 0.217],  [60, 7, 4, 0.211])$
m : addrow(m,  [40, 7, 4, 0.226], [280, 7, 8, 0.274],  [260, 7, 8, 0.259],  [240, 7, 8, 0.255],
[220, 7!  , 8, 0.253],  [200, 7, 8, 0.262],  [180, 7, 8, 0.256],  [160, 7, 8, 0.251],  [140, 7,
8, 0.247],  [120, 7, 8, 0.237])$
m : addrow(m,  [100, 7, 8, 0.232],  [80, 7, 8, 0.225],  [60, 7, 8, 0.225],  [40, 7, 8, 0.239],
[280, 22, 0, 0.271],  [260, 22, 0, 0.256],  [240, 22, 0, 0.256],  [220, 22, 0, 0.255],  [200,
22, 0, 0.257],  [180, 22, 0, 0.247])$
m : addrow(m,  [160, 22, 0, 0.240],  [140, 22, 0, 0.239],  [120, 22, 0, 0.232],  [100, 22, 0,
0.230],  [80, 22, 0, 0.228],  [60, 22, 0, 0.231],  [40, 22, 0, 0.257],  [280, 22, 2, 0.278],
[260, 22, 2, 0.263],  [240, 22, 2, 0.257])$
m : addrow(m,  [220, 22, 2, 0.257],  [200, 22, 2, 0.260],  [180, 22, 2, 0.254],  [160, 22, 2,
0.248],  [140, 22, 2, 0.242],  [120, 22, 2, 0.230],  [100, 22, 2, 0.224],  [80, 22, 2, 0.216],
[60, 22, 2, 0.213],  [40, 22, 2, 0.237])$
m : addrow(m,  [280, 22, 4, 0.279],  [260, 22, 4, 0.267],  [240, 22, 4, 0.260],  [220, 22, 4,
0.262],  [200, 22, 4, 0.268],  [180, 22, 4, 0.261],  [160, 22, 4, 0.255],  [140, 22, 4, 0.247],
[120, 22, 4, 0.238],  [100, 22, 4, 0.230])$
m : addrow(m,  [80, 22, 4, 0.224],  [60, 22, 4, 0.217],  [40, 22, 4, 0.235],  [280, 22,  8,
0.290],  [260, 22, 8, 0.272],  [240, 22, 8, 0.270],  [220, 22, 8, 0.265],  [200, 22, 8, 0.277],
[180, 22, 8, 0.269],  [160, 22, 8, 0.264])$
m : addrow(m,  [140, 22, 8, 0.254],  [120, 22, 8, 0.244],  [100, 22, 8, 0.236],  [80, 22, 8,
0.229],  [60, 22, 8, 0.223],  [40, 22, 8, 0.238])$

This is the matrix that you have previously posted. 
The typos are corrected too. 
But I am not sure about.

Laurent.