I'm very new to Java and I'm basically teaching myself. I'm writing a program where I need to plot some values. I have a while loop and I need to print x and y values to a text file that I can later graph using gnuplot. If someone can help me make two colums of x and y values to a text file I would really appreciate it!
gor.irina 0 Newbie Poster
Recommended Answers
Jump to PostBy columns I assume you mean two fields of data separated by some spaces on the same line. The line ending with a newline character.
When you build the record insert the number of spaces between the two fields and add a newline char at the end:
String rec = …
Jump to Post%f is formatter for float data type.
In Printf() function, you have to specify the formatter for data type - like %d for int, %s for String, %f for float etc. And /n implies new line. After printing each line, it will print a new line i.e. next output will …
Jump to PostMark the thread as solved, if your purpose solved.
%f is formatter for float data type.
In Printf() function, you have to specify the formatter for data type - like %d for int, %s for String, %f for float etc. And /n implies new line. After printing each line, it …
All 12 Replies
NormR1 563 Posting Sage Team Colleague
jon.kiparsky 326 Posting Virtuoso
gor.irina 0 Newbie Poster
NormR1 563 Posting Sage Team Colleague
gor.irina 0 Newbie Poster
NormR1 563 Posting Sage Team Colleague
gor.irina 0 Newbie Poster
NormR1 563 Posting Sage Team Colleague
gor.irina 0 Newbie Poster
NormR1 563 Posting Sage Team Colleague
java_programmer 0 Junior Poster
java_programmer 0 Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.