I use matlab to format a 4 columns dataset into a ascii file which is in turn the input for a fortran routine (that i cannot modify or see the source).
I found that the following code does produce the good array of characters (spaces, numeric, text) but i need to open the txt file with a text editor afterwards and "save as" "DATA *.dat" to make it suitable for my fortran routine.
Is there a way to do that within my matlab code ?
No products are associated with this question.
What happens if you just change
What encoding does the fortran-program require?
Doc on fopen says:
encoding String that specifies the character encoding scheme to use for subsequent read and write operations, including fscanf, fprintf, fgetl, fgets, fread, and fwrite.
There is no particular format for .dat files; ".dat" is a suffix used to mean any binary format (and probably not one of the standardized ones.)
What you might perhaps be looking for is to use Fortran's unformatted read. If that is the case, then write the data out using fwrite()
Play games and win prizes!Learn more