<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic NOTE 10.7 The effect of an in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Export-outputs-to-csv-file/m-p/1134515#M135293</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;NOTE 10.7 The effect of an unlimited-format-item is as if its enclosed list were preceded by a very large repeat count. There is no file positioning implied by unlimited-format-item reversion. This may be used to write what is commonly called a comma separated value record. For example, WRITE( 10, ’( "IARRAY =", *( I0, :, ","))’) IARRAY produces a single record with a header and a comma separated list of integer values.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://j3-fortran.org/doc/year/10/10-007r1.pdf&amp;nbsp;" target="_blank"&gt;https://j3-fortran.org/doc/year/10/10-007r1.pdf&amp;nbsp;&lt;/A&gt;;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Mar 2020 19:16:30 GMT</pubDate>
    <dc:creator>andrew_4619</dc:creator>
    <dc:date>2020-03-06T19:16:30Z</dc:date>
    <item>
      <title>Export outputs to csv file</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Export-outputs-to-csv-file/m-p/1134510#M135288</link>
      <description>&lt;P&gt;Im new with programming&lt;/P&gt;&lt;P&gt;According to this code i want to export my output to csv file. The problem is i prefer to export every 100 number in each row&amp;nbsp;which have totally 10 row,&amp;nbsp;but it export all numbers in one column. How can i fix&amp;nbsp;it?&lt;/P&gt;&lt;P&gt;With regard&lt;/P&gt;
&lt;PRE class="brush:fortran; class-name:dark;"&gt; program Console5
    implicit none 
    
    integer::  i,j
    real rand
    real, dimension (100):: a
   CALL RANDOM_SEED	
   
    open(unit=1,file='test.csv',status='unknown')
    do i=1,10     
    do j=1,100
    call random_number(rand)
    a(j)=(rand*1)
     write(1,*) a(j)
    end do   
    end do
    
  end program&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Mar 2020 22:17:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Export-outputs-to-csv-file/m-p/1134510#M135288</guid>
      <dc:creator>ahmadi__milad</dc:creator>
      <dc:date>2020-03-01T22:17:24Z</dc:date>
    </item>
    <item>
      <title>To provide an answer, here</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Export-outputs-to-csv-file/m-p/1134511#M135289</link>
      <description>&lt;P&gt;For completeness, I can think of the following approaches for writing a 10x100 table:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;(a) Write elements individually&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE class="brush:fortran; class-name:dark;"&gt;program p1
  integer :: i, j
  real :: a
  open(unit=1,file='test.csv',status='unknown')
  do i = 1,10
    do j = 1,100
      ! compute next element
      call random_number(a)
      ! write element (no linebreak)
      write(1,'(g14.7,x)',advance='no') a
    end do
    write(1,*)  ! newline
  end do
  close(1)
end program&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;(b) Write line by line&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE class="brush:fortran; class-name:dark;"&gt;program p2
  integer :: i
  real, dimension(100) :: a
  open(unit=1,file='test.csv',status='unknown')
  do i = 1,10
    ! compute next line
    call random_number(a)
    ! write line
    write(1,'(100(g14.7,x))') a
  end do
  close(1)
end program&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;(c) Write entire table at once&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE class="brush:fortran; class-name:dark;"&gt;program p3
  real, dimension (100,10):: a
  ! precompute full table
  call random_number(a)
  ! write table
  open(unit=1,file='test.csv',status='unknown')
  write(1,'(100(g14.7,x))') a
  close(1)
end program&lt;/PRE&gt;

&lt;P&gt;If the table is not too large, I'd prefer the last variant (c) for simplicity and performance reasons. It also mandates strict separation of computation and IO. However, the first program (a) is the most flexible in that it can handle variable numbers of elements per line, alternating output formats, etc.&lt;/P&gt;
&lt;P&gt;Note that all variants require formatted output, and I used the format 'g14.7' just as an example.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Mar 2020 16:41:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Export-outputs-to-csv-file/m-p/1134511#M135289</guid>
      <dc:creator>Ferdinand_T_</dc:creator>
      <dc:date>2020-03-04T16:41:00Z</dc:date>
    </item>
    <item>
      <title>The example above are 'space'</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Export-outputs-to-csv-file/m-p/1134512#M135290</link>
      <description>&lt;P&gt;The example above are 'space' separated nor comma separated. If you want comma I would use:&lt;/P&gt;
&lt;PRE class="brush:; class-name:dark;"&gt;write(1,'(100(g14.7,:,","))') a 

or

write(1,'(*(g14.7,:,","))') a 

&lt;/PRE&gt;

&lt;P&gt;The : (colon) terminates the format&amp;nbsp;if there are no more items, thus stopping a trailing comma being written.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 17:49:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Export-outputs-to-csv-file/m-p/1134512#M135290</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2020-03-06T17:49:00Z</dc:date>
    </item>
    <item>
      <title>Consider using G0.7 instead</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Export-outputs-to-csv-file/m-p/1134513#M135291</link>
      <description>&lt;P&gt;Consider using G0.7 instead of G14.7.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 18:08:07 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Export-outputs-to-csv-file/m-p/1134513#M135291</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2020-03-06T18:08:07Z</dc:date>
    </item>
    <item>
      <title>Andrew,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Export-outputs-to-csv-file/m-p/1134514#M135292</link>
      <description>&lt;P&gt;Andrew,&lt;/P&gt;&lt;P&gt;can you comment on the asterisk in your second format? I remember from experimenting with it that it behaves like an infinite repeat count, but couldn't find it documented anywhere in the standard or in the Intel compiler documentation.&lt;/P&gt;&lt;P&gt;Kind regards, Ferdinand&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 18:14:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Export-outputs-to-csv-file/m-p/1134514#M135292</guid>
      <dc:creator>Ferdinand_T_</dc:creator>
      <dc:date>2020-03-06T18:14:55Z</dc:date>
    </item>
    <item>
      <title>NOTE 10.7 The effect of an</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Export-outputs-to-csv-file/m-p/1134515#M135293</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;P&gt;NOTE 10.7 The effect of an unlimited-format-item is as if its enclosed list were preceded by a very large repeat count. There is no file positioning implied by unlimited-format-item reversion. This may be used to write what is commonly called a comma separated value record. For example, WRITE( 10, ’( "IARRAY =", *( I0, :, ","))’) IARRAY produces a single record with a header and a comma separated list of integer values.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://j3-fortran.org/doc/year/10/10-007r1.pdf&amp;nbsp;" target="_blank"&gt;https://j3-fortran.org/doc/year/10/10-007r1.pdf&amp;nbsp;&lt;/A&gt;;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 19:16:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Export-outputs-to-csv-file/m-p/1134515#M135293</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2020-03-06T19:16:30Z</dc:date>
    </item>
    <item>
      <title>Thank you! A search for</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Export-outputs-to-csv-file/m-p/1134516#M135294</link>
      <description>&lt;P&gt;Thank you! A search for "unlimited format item" also brings up one of Steve's &lt;A href="https://software.intel.com/en-us/blogs/2009/07/01/doctor-fortran-in-revert-revert-the-end-of-the-format-is-nigh"&gt;Dr. Fortran articles&lt;/A&gt; dealing, in part, with the question aked by the OP.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 21:05:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Export-outputs-to-csv-file/m-p/1134516#M135294</guid>
      <dc:creator>Ferdinand_T_</dc:creator>
      <dc:date>2020-03-06T21:05:00Z</dc:date>
    </item>
    <item>
      <title>On the subject of comma</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Export-outputs-to-csv-file/m-p/1134517#M135295</link>
      <description>&lt;P&gt;On the subject of comma separated value it is better to define a separator character that can be set by the software or user. Comma is generally OK&amp;nbsp;in the USA and UK but in many&amp;nbsp;places it is used as a decimal separator and semi-colon ";" is often used instead.&amp;nbsp; This can be the source of many problems if not considered properly.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 21:26:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Export-outputs-to-csv-file/m-p/1134517#M135295</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2020-03-06T21:26:17Z</dc:date>
    </item>
  </channel>
</rss>

