manpagez: man pages & more
info mathgl_en
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.5 File I/O

MGL command: read DAT 'fname'
Method on mglData: void Read (const char *fname)
C function: void mgl_data_read (HMDT dat, const char *fname)

Reads data from tab-separated text file with auto determining sizes of the data. Double newline means the beginning of new z-slice.

MGL command: read DAT 'fname' mx [my=1 mz=1]
Method on mglData: void Read (const char *fname, int mx, int my=1, int mz=1)
C function: void mgl_data_read_dim (HMDT dat, const char *fname, int mx, int my, int mz)

Reads data from text file with specified data sizes. This function does nothing if one of parameters mx, my or mz is zero or negative.

MGL command: readmat DAT 'fname' [dim=2]
Method on mglData: void ReadMat (const char *fname, int dim=2)
C function: void mgl_data_read_mat (HMDT dat, const char *fname, int dim)

Read data from text file with size specified at beginning of the file by first dim numbers. At this, variable dim set data dimensions.

MGL command: readall DAT 'templ' v1 v2 [dv=1 slice=off]
Method on mglData: void ReadRange (const char *templ, float from, float to, float step=1.f, bool as_slice=false)

Join data arrays from several text files. The file names are determined by function call sprintf(fname,templ,val);, where val changes from from to to with step step. The data load one-by-one in the same slice if as_slice=false or as slice-by-slice if as_slice=true.

MGL command: readall DAT 'templ' [slice=off]
Method on mglData: void ReadAll (const char *templ, bool as_slice=false)

Join data arrays from several text files which filenames satisfied the template templ (for example, templ="t_*.dat"). The data load one-by-one in the same slice if as_slice=false or as slice-by-slice if as_slice=true.

MGL command: save dat 'fname'
Method on mglData: void Save (const char *fname, int ns=-1) const
C function: void mgl_data_save (HCDT dat, const char *fname, int ns)

Saves the whole data array (for ns=-1) or only ns-th slice to text file.

MGL command: readhdf DAT 'fname' 'dname'
Method on mglData: void ReadHDF (const char *fname, const char *dname)
C function: void mgl_data_read_hdf (HMDT dat, const char *fname, const char *dname)

Reads data array named dname from HDF5 or HDF4 file. This function does nothing if HDF5|HDF4 was disabled during library compilation.

MGL command: savehdf dat 'fname' 'dname'
Method on mglData: void SaveHDF (const char *fname, const char *dname, bool rewrite=false) const
C function: void mgl_data_save_hdf (HCDT dat, const char *fname, const char *dname, int rewrite)

Saves data array named dname to HDF5 file. This function does nothing if HDF5 was disabled during library compilation.

MGL command: datas 'fname'
Method on mglData: void DatasHDF (const char *fname, char *buf, long size) const
C function: void mgl_datas_hdf (const char *fname, char *buf, long size)

Put data names from HDF5 file fname into buf as ’\t’ separated fields. In MGL version the list of data names will be printed as message. This function does nothing if HDF5 was disabled during library compilation.

MGL command: import DAT 'fname' 'sch' [v1=0 v2=1]
Method on mglData: void Import (const char *fname, const char *scheme, float v1=0, float v2=1)
C function: void mgl_data_import (HMDT dat, const char *fname, const char *scheme, float v1, float v2)

Reads data from bitmap file (now support only PNG format). The RGB values of bitmap pixels are transformed to float values in range [v1, v2] using color scheme scheme (see section Color scheme).

MGL command: export dat 'fname' 'sch' [v1=0 v2=0]
Method on mglData: void Export (const char *fname, const char *scheme, float v1=0, float v2=0, int ns=-1) const
C function: void mgl_data_export (HMDT dat, const char *fname, const char *scheme, float v1, float v2, int ns) const

Saves data matrix (or ns-th slice for 3d data) to bitmap file (now support only PNG format). The data values are transformed from range [v1, v2] to RGB pixels of bitmap using color scheme scheme (see section Color scheme). If v1>=v2 then the values of v1, v2 are automatically determined as minimal and maximal value of the data array.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on April 13, 2012 using texi2html 5.0.