On Tuesday, June 4, 2013 8:25:18 AM UTC+12, Michael wrote:
> Hi,
>
>
>
> I have a variable in my workspace that is a <9583x5 double> and I wish to save it as a text *.dat file along with a 2 line header that resembles this:
>
>
>
> TITLE = "Particle Test 5"
>
> VARIABLES = "x", "y", "z", "t", "ID"
>
>
>
> Do you guys have an idea of how I could go about doing this? Additionally I would like to be able to specify the file name and the root directory and folder where it gets saved but I think I can figure this out myself. Thanks!
help fprintf
You will need to decide what you want as the delimiter. There are lots of options:
whitespace: '%f %f %f %f %f\n'
comma: '%f,%f,%f,%f,%f\n'
tab: '%f\t%f\t%f\t%f\t%f\n'
Also, note that the way fprintf works, you will need to transpose the matrix to 5x9583 before printing.
> Hi,
>
>
>
> I have a variable in my workspace that is a <9583x5 double> and I wish to save it as a text *.dat file along with a 2 line header that resembles this:
>
>
>
> TITLE = "Particle Test 5"
>
> VARIABLES = "x", "y", "z", "t", "ID"
>
>
>
> Do you guys have an idea of how I could go about doing this? Additionally I would like to be able to specify the file name and the root directory and folder where it gets saved but I think I can figure this out myself. Thanks!
help fprintf
You will need to decide what you want as the delimiter. There are lots of options:
whitespace: '%f %f %f %f %f\n'
comma: '%f,%f,%f,%f,%f\n'
tab: '%f\t%f\t%f\t%f\t%f\n'
Also, note that the way fprintf works, you will need to transpose the matrix to 5x9583 before printing.