How to write a big file
Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
Ältere Kommentare anzeigen
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 Kommentar
Matt Kindig
am 12 Jul. 2013
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?
Antworten (1)
per isakson
am 12 Jul. 2013
0 Stimmen
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 Kommentare
ita
am 12 Jul. 2013
per isakson
am 12 Jul. 2013
Bearbeitet: per isakson
am 13 Jul. 2013
"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?
Diese Frage ist geschlossen.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!