## 28 Reputation

14 years, 296 days

## There are problems though......

Following Doug's advice I've modified his code to fit my needs and I've replaced 'RandomMatrix' with 'readdata' in order to extract data from my files. But it seems that this replacement changes the nature of the Xmat. While still a Matrix, a call to Xmat[2,1] does not return a scalar but a list!? Here is the code: > restart; > with(LinearAlgebra); > j := 1; > T := 10; > S := 10; > Xmat := Matrix(T, S); Dmat := Matrix(1000, 5); > for i to S do fname := cat("x_0.001.dat", i); Dmat := readdata(fname, 5); Xmat[1 .. T, i] := Dmat[1 .. T, j] end do; > op(1, Xmat); 10, 10 > op(0, Xmat); Matrix > Xmat[2, 1]; [-0.285209, -0.186423, -0.0853201, 0.0169167, 0.118889, 0.218986, 0.31541, 0.406231, 0.489475, 0.563226] It seems that reading from a file converts Dmat to a 'listlist'. Indeed: > op(0, Dmat); list > type(Dmat,listlist); true Making the following forced conversion > for i to S do fname := cat(dir, "x_0.001.dat", i); Dmat := readdata(fname, 5); Dmat := convert(Dmat, Matrix); Xmat[1 .. T, i] := Dmat[1 .. T, j] end do; > op(1, Xmat); 10, 10 > Xmat[2, 1]; -0.186423 seems to preserve the character of Xmat. Now Dmat remains a matrix too: > op(0, Dmat); Matrix What I do not understand is why Xmat, in the first case, still reports a Matrix type, even though it seems to me, it doesn't behave so?

## Thanks, Doug! It works...

Thanks, Doug! It works exactly as you said it would and it is reasonably fast. You have also increased my enthusiasm for Maple ten fold! And I've really started to appreciate this forum and its usefulness in improving the quality and efficiency of my work - and the joy of using Maple. Thanks, Marian
 Page 1 of 1
﻿