How to write a big file
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
I need to write a .dat file to be read by a program. The problem is that this .dat has 2700 lines and I can not write fprint for each line. Here is an extract of the program:
CASO TESTE LE e LDireito
< MACH >< ALPHA >[ BETA ]< RE >< CAX >< SW >
0.840 0.30000 0. 33000000. 3.194 72.7200
[ ICL ][ CL ][ DCLDA ]
0. .45 .10
[ PSE ][ DELWING][ IBEAM ][ IAIL ][ IROT ][ IBLF ]
1. 0. 0. 0. 0. 0.
[ PA1 ]
0.70
[ PA2 ]
.77
Some of these numbers are not variable, so they can be written, but some are variables and must be %10f.
What can I do?
Thank you
1 件のコメント
Matt Kindig
2013 年 7 月 12 日
Why can't you write fprintf for each line? How are the various fields (<MACH>, < DELWING>, etc.) determined? In what form is your current data?
回答 (1 件)
per isakson
2013 年 7 月 12 日
0 投票
2700 rows of text should be no problem to write with fprintf and a loop. The resulting file will be a couple of MB at most. There is no better way.
You need to be more specific on the reason to why you write "I can not write fprint for each line."
2 件のコメント
ita
2013 年 7 月 12 日
per isakson
2013 年 7 月 12 日
編集済み: per isakson
2013 年 7 月 13 日
"and this is not feasable." Why? I cannot see any reason why not.
Let me get this clear. You write "Here is an extract of the program:", but the following lines are they not an excerpt of a .dat-file, i.e they display the required format of the .dat-file? That is, the result of the Matlab program, which you are developing.
CASO TESTE LE e LDireito
< MACH >< ALPHA >[ BETA ]< RE >< CAX >< SW >
0.840 0.30000 0. 33000000. 3.194 72.7200
[ ICL ][ CL ][ DCLDA ]
0. .45 .10
[ PSE ][ DELWING][ IBEAM ][ IAIL ][ IROT ][ IBLF ]
1. 0. 0. 0. 0. 0.
[ PA1 ]
0.70
[ PA2 ]
.77
This row
CASO TESTE LE e LDireito
is it a file-header, or is repeated throughout the .dat-file?
Then follows five pairs of one column header row and one data row. Is that correct? You write "evaluate 8 numbers [...] and these data will be used to write the .dat ", however I count to 17 numbers.
The .dat-file should contain 2700 groups of these five pairs of rows. Correct?
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!