• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

write a matrix into a File.

 
Ranch Hand
Posts: 74
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everyone,
I want to know that how to write a matrix into text file?
actually here i am trying to write a program which take no of rows and columns from user and also element of matrix and then i want to store that matrix into a separate file(abc.txt) and it's Transpose result
want to store in separate file(xyz.txt). for this i am stuck in, i am not getting idea that how to save my matrix into a file...
i have been searched regarding of my this problem but did not find any clue . let me post my code whatever effort i did to do...




please help me,
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

viki Bhardwaj wrote:for this i am stuck in, i am not getting idea that how to save my matrix into a file...


I suspect that's mostly because you don't have a Matrix class.

If you did, then you could implement it's toString() method to return it in String form, and then write that to a File.

Tip: If all your code is in main() (indeed, if your main() method is more than a few lines long) then you're probably doing it WRONG.

Winston
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Note that any serious program getting user keyboard input should provide for error handling - for example non-digit character input - see the Scanner JavaDocs for the exceptions you should provide for.

Bill
 
Rancher
Posts: 1044
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could map your Matrix into an XML format and write it as such.

Property has by the way a built-in conversion to XML format, cf. java.util.Properties.storeToXML and loadFromXML.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic