A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Joined: Nov 21, 2004
May 25, 2007 08:34:00
I have to create (through a number of computational methods) a matrix of data. As an example here is one:
A B C A 0 8 9 B 8 0 7 C 9 7 0
What I need to do is store this matrix in a text file, tab-delimited.
What I would like to know is whether it would be easier to create a 2-dimensional [n][n] array first and then copy the contents of it over to the file, or form the matrix in the file directly.
Moosey knows best
author and iconoclast
Joined: Jul 08, 2003
May 25, 2007 10:12:00
I would think not only easier, but far cleaner. Separating your I/O code and your computational code into different methods (or even different classes) will make the whole thing easier to develop.
[Jess in Action]
Joined: May 02, 2007
May 28, 2007 01:31:00
I agree. Make sure that you have a class holding your data and later think serializing it to a file.
<a href="http://www.java-forums.org" target="_blank" rel="nofollow">Java Forums</a>
I agree. Here's the link:
subject: Advice please
Complex Numbers in Java
need explanation about constructor
Help me with matrix...please!!!!!!!
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015