• 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

How do read a double datatype 2D array into your applet code from a text file

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hey Guys i am not good with file input output operations. Here i have a code which generates an airfoil. The coordinates for the airfoil are entered manually in the code. But now i want them to be entered through a file. So now i have created a text file with coordinates which are of double data type.
i have created the text file as follows
ex:
0.32341,0,434334,4.34343,0.323242.......
0.344343,9.34342342,4.32342,2.342234......
the text file has only 2 rows and 100 columns elements seperated by commas. Please let me know whether the text file i have created is correct or not. Also i have made some additions to the code that i have attached below. But there are errors in it. Can some one help me out with this???
[\CODE]
the coordinates are nothing but the ones mentioned above as "cds" which is a 2D array. i need to read the coordinates from the text file and then assign it to cds so that the code works fine as i change the text file.

Please help me out with this.
Thanks in advance......
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
600+ lines of code, and posted in at least one other forum

http://forums.devshed.com/java-help-9/how-do-read-a-double-datatype-2d-array-into-your-752454.html

why would any sane person waste time trying to help you?
 
Ranch Hand
Posts: 67
Eclipse IDE Debian Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you be more specific please. What you have could work, but I am not sure what your current problem is.
 
Sainath Satish
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oh Gosh!!!. One need not go through 600 lines of code. My question was very simple. How do i accept input from a text file and assign it to a 2D array in my code which is "cds". Thats it guys. I just need to know whether i am doing is right or wrong.
[\CODE]

When i do this i get an error. Can some one help me out with this??? All i want is the array which is read in the file must be assigned to "cds"array.

Thanks in advance for the response

 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sainath Satish wrote:Oh Gosh!!!. One need not go through 600 lines of code.


We don't know this when presented with a mountain of code.

My question was very simple. How do i accept input from a text file and assign it to a 2D array in my code which is "cds". Thats it guys. I just need to know whether i am doing is right or wrong.


You may do best by creating a new small compilable and runnable program (not an uncompilable snippet as above) that demonstrates your problem, and that we can inspect, run, modify and correct, an SSCCE. As volunteers we all very much appreciate any effort you put in to help make our helping you easier.

Also, where else have you cross-posted this question, and please provide links. Please read the FAQ regarding cross-posts (BeForthrightWhenCrossPostingToOtherSites) to know why this is important to us, but again it has to do with your helping volunteers help you.

Best of luck!
 
Sainath Satish
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am really out of ideas and my brain has stopped working.
I really cannot proceed any further. Thanks anyways guys for your valuable time and responses.

Keep up the good work.
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sainath Satish wrote:I am really out of ideas and my brain has stopped working.
I really cannot proceed any further. Thanks anyways guys for your valuable time and responses.

Keep up the good work.



Don't give up as you're so close. We're not asking for much, just again that you use your code above to create a tiny program that simply extracts data from a text file and then displays it on the command. This program will take no more than 40 lines at most. Do this and you will be well on your way to solving this or at least letting us help you solve it. Trust me, the effort will be well worth it. And also still the list of cross-posts...
 
Sainath Satish
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://forums.devshed.com/java-help-9/java-awt-746288-2.html
This is the forum where i have posted my earlier problems and this one.

All i ask you for is just run the code that first code i had posted which i have edited you will find that the values are printed in the command prompt. the only problem is that it is not getting assigned to the "cds"array which i have defined for the coordinates. That is all with this.
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sainath Satish wrote:http://forums.devshed.com/java-help-9/java-awt-746288-2.html
This is the forum where i have posted my earlier problems and this one.


Thanks.

All i ask you for is just run the code that first code i had posted which i have edited you will find that the values are printed in the command prompt. the only problem is that it is not getting assigned to the "cds"array which i have defined for the coordinates. That is all with this.


And all I ask of you is for a small compilable runnable program that has code only pertaining to the problem, an SSCCE as again, it will make it much easier for anyone here to help you. For now, I have to get back to the obligations of my job, but will look back here in a bit, hopeful to see your code.

Best of luck!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic