Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
公告
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Output to an Excel File

bobae
初学者
1,547 次查看
I compiled a .exe file and it outputs a huge amount of data. How do I make it output to an Excel file or at least put it into columns that I can copy and paste? Thank you!
0 项奖励
8 回复数
Peter
初学者
1,547 次查看
[cpp]program example
real(8), dimension(5):: a,b
 data a/1.0,2.0,3.0,4.0,5.0/,b/6.0,7.0,8.0,9.0,10.0/
 open(unit=5,file='ab.txt', status='unknown')
write(5,6) a,b
6 format(5f5.1,/5f5.1)
end [/cpp]
the output in a text file (ab.txt) looks like this

1.0 2.0 3.0 4.0 5.0
6.0 7.0 8.0 9.0 10.0

the key here is having good knowledge in 'open' and 'format' statements !
HTH


0 项奖励
jimdempseyatthecove
名誉分销商 III
1,547 次查看
Quoting - bobae
I compiled a .exe file and it outputs a huge amount of data. How do I make it output to an Excel file or at least put it into columns that I can copy and paste? Thank you!

I use a formatted write with fixed length fields. Use .TXT as file type. Excel will prompt you as to if the file is to be comma delimited or fixed. It does a good job as long as you do not have more that 65,000 lines. Once read in, Save As to Excel Workbook format. With formatted write you can write a rather large number of columns. If you get unwanted line break look at using the RECL specifier in the OPEN.

What is your definition of "huge amount of data"?

Jim Dempsey
0 项奖励
DavidWhite
重要分销商 II
1,547 次查看
Can also add CHAR(9) between each numerical value (add "A" format descriptor to the format statement). The file then is a tab-delimited text file, which Excels import wizard will recognize an immediately parse the data into cells.
0 项奖励
bmchenry
新分销商 II
1,547 次查看
I'd suggest you trythe following:
1) output to a file with suffix CSV (Comma delimited)
2)insert a comma between variables in your output format statements.
then Excel or other database programs can easily import the data.

0 项奖励
yourmohsin
初学者
1,547 次查看

I use the following simple formated output statements to get my data out for use in MATLAB. Matlab automatically detect the format and load it without any problem and I guess same would be with excel. Itwrites data in rows and my output is normallyabout 1000 rows of NLX data points (columns)

OPEN(101, FILE='Output_Sc.dat')! open output file to write Sc

WRITE
(101,5)(Sc(IP), IP=1,NLX)! write Sc in file

5 FORMAT (1701E10.2, T1)!1701(=NLX) is number of data points/colums


I hope may be helpful to you.
0 项奖励
wolfgang_knott
初学者
1,547 次查看
Hello!

If you do not like these intermediate files you may want to have a look at the AUTODICE example (part of older versions of the compiler).

Wolfgang

0 项奖励
Steven_L_Intel1
1,547 次查看
AUTODICE is part of the current product samples.
0 项奖励
joerg_kuthe
新手
1,547 次查看
Quoting - bobae
I compiled a .exe file and it outputs a huge amount of data. How do I make it output to an Excel file or at least put it into columns that I can copy and paste? Thank you!
I hope that I am allowed to point you to a library I once developed for that purpose:
qtXLS
qtXLS uses Excel's ODBC driver (comes with Excel) to read from and to write to Excel files (.xls) directly. Here is more information:
http://www.qtsoftware.de/vertrieb/db/qtxls_e.htm

Regards,
Joerg Kuthe
www.qtsoftware.de
0 项奖励
回复