One way to do it is to use the Python functions on strings. For example, if you want to use the real double field (RDF) and matrix_data is your string, the following should do what you want: M = matrix(RDF, [b.split() for b in matrix_data.split('\n')])
The split method of a string creates a list of substrings that are separated by a given separator, and the default separator is whitespace. See the documentation on RDF to see if you want to use that, or RR or something else. David On Jan 10, 2008 11:42 AM, myFalc <[EMAIL PROTECTED]> wrote: > > Hello! > I'm new to sage and I already searched for a solution on the web, but > couldn't find any. > At the moment I'm trying to load a file into sage and put its data > into a matrix. The file spans a matrix of thousands of float values. > columns separated by whitespaces and rows separated by newlines. > I was able to load the data into a string(or list) but i couldn't find > out how to put the data into a matrix. > e.g. M = Matrix(10,2,(string)) is not working. > anyone with ideas or solutions? > > i used octave before, and it worked really easy there. unfortunately i > can't use the octave load commands in sage since there are semicolons > needed for the command which result in a syntax error. > > greetings > markus > > > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---