Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran spacing/coordinate question

  1. Sep 3, 2006 #1
    Since the graphing idea is not available. Does the fortran write/print command let me choose where a number or * is printed at. Like a row column thing if I want to print say a * on the page.

    Code (Text):
    *                                *                              *

    *             *                                *                *
    Something like that. Can I make sure it ends where I want it to end up without counting how many spaces it takes to display something.
    Last edited: Sep 3, 2006
  2. jcsd
  3. Sep 5, 2006 #2


    User Avatar
    Homework Helper

    Create a character (text) array the size of a print line. Fill it with spaces and asterisks., then print it. You could create a matrix, then print out one row at a time.
  4. Sep 6, 2006 #3
    I suppose this is the way to do it. I actually needed to give each asterisk an x and y coordinate value, so I can print them out anywhere I choose. But I try this.
  5. Sep 6, 2006 #4
    You can use a character variable to hold a format statement. That would save you some memory space over jeff's method.
  6. Sep 6, 2006 #5
    how do i do that, please help, point me in the right direction
  7. Sep 6, 2006 #6


    User Avatar
    Homework Helper

    I don't think memory space is an issue on a PC in this case. Also if the plot is an alternating pattern of asterisks and spaces, then the character variable for the format statement would be longer than just character array.
  8. Sep 6, 2006 #7
    I dont really need *, I am happy to use 0 and 1 etc
  9. Sep 6, 2006 #8
    Well, memory is always an issue for me, on every machine I've used (No 4 GB of RAM isnt really enough. Nor is 500 GB of disk storage), so i thought I'd suggest it.

    A format statement of the form:

    '(1A, NX, 1A, NX,...)'

    will be shorter than the array if N is on average greater than 4.

    Also, if you have many lines, it will be more efficient to have one format string that the program creates, and a single array holding coordinates for each *.

    On the other hand, I'm used to dealing with 3-D data arrays that have more than 8 million cells, and needing to store a half dozen arrays with that many cells in double precision. So my concern may be unwarranted. I do think your method would be easier to implement, just less memory efficient.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Fortran spacing/coordinate question
  1. Fortran Question (Replies: 19)

  2. Question - Fortran (Replies: 2)

  3. FORTRAN Question (Replies: 4)

  4. Fortran question (Replies: 2)

  5. Fortran Question (Replies: 32)