This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How do read a double datatype 2D array into your applet code from a text file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "How do read a double datatype 2D array into your applet code from a text file" Watch "How do read a double datatype 2D array into your applet code from a text file" New topic
Author

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

Sainath Satish
Greenhorn

Joined: Oct 09, 2010
Posts: 3
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......
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
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?
Mike Peters
Ranch Hand

Joined: Oct 10, 2009
Posts: 67

Could you be more specific please. What you have could work, but I am not sure what your current problem is.


Mike Peters
Sainath Satish
Greenhorn

Joined: Oct 09, 2010
Posts: 3
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

pete stein
Bartender

Joined: Feb 23, 2007
Posts: 1561
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

Joined: Oct 09, 2010
Posts: 3
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

Joined: Feb 23, 2007
Posts: 1561
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

Joined: Oct 09, 2010
Posts: 3
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

Joined: Feb 23, 2007
Posts: 1561
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!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How do read a double datatype 2D array into your applet code from a text file
 
Similar Threads
Graphics?????
AffineTransform Rectangle2D
'Moving' a circle along a line
Drawing graphs
Can anybody help??