DAT 'fname'
¶REDAT IMDAT 'fname'
¶mglData
: bool
Read (const char *
fname)
¶mglDataC
: bool
Read (const char *
fname)
¶int
mgl_data_read (HMDT
dat, const char *
fname)
¶int
mgl_datac_read (HADT
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.
DAT 'fname' mx [my=1 mz=1]
¶REDAT IMDAT 'fname' mx [my=1 mz=1]
¶mglData
: bool
Read (const char *
fname, int
mx, int
my=1
, int
mz=1
)
¶mglDataC
: bool
Read (const char *
fname, int
mx, int
my=1
, int
mz=1
)
¶int
mgl_data_read_dim (HMDT
dat, const char *
fname, int
mx, int
my, int
mz)
¶int
mgl_datac_read_dim (HADT
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.
DAT 'fname' [dim=2
]
¶mglData
: bool
ReadMat (const char *
fname, int
dim=2
)
¶mglDataC
: bool
ReadMat (const char *
fname, int
dim=2
)
¶int
mgl_data_read_mat (HMDT
dat, const char *
fname, int
dim)
¶int
mgl_datac_read_mat (HADT
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.
DAT 'templ' v1 v2 [dv=1 slice=off]
¶mglData
: void
ReadRange (const char *
templ, mreal
from, mreal
to, mreal
step=1
, bool
as_slice=false
)
¶mglDataC
: void
ReadRange (const char *
templ, mreal
from, mreal
to, mreal
step=1
, bool
as_slice=false
)
¶int
mgl_data_read_range (HMDT
dat, const char *
templ, mreal
from, mreal
to, mreal
step, int
as_slice)
¶int
mgl_datac_read_range (HADT
dat, const char *
templ, mreal
from, mreal
to, mreal
step, int
as_slice)
¶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
.
DAT 'templ' [slice=off]
¶mglData
: void
ReadAll (const char *
templ, bool
as_slice=false
)
¶mglDataC
: void
ReadAll (const char *
templ, bool
as_slice=false
)
¶int
mgl_data_read_all (HMDT
dat, const char *
templ, int
as_slice)
¶int
mgl_datac_read_all (HADT
dat, const char *
templ, int
as_slice)
¶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
.
DAT 'fname' 'templ'
¶mglData
: bool
ScanFile (const char *
fname, const char *
templ)
¶int
mgl_data_scan_file (HMDT
dat, const char *
fname, const char *
templ)
¶Read file fname line-by-line and scan each line for numbers according the template templ. The numbers denoted as ‘%g’ in the template. See Scanning file, for sample code and picture.
dat 'fname'
¶mglDataA
: void
Save (const char *
fname, int
ns=-1
) const
¶void
mgl_data_save (HCDT
dat, const char *
fname, int
ns)
¶void
mgl_datac_save (HCDT
dat, const char *
fname, int
ns)
¶Saves the whole data array (for ns=-1
) or only ns-th slice to the text file fname.
val
dat 'fname'
¶Saves the value val to the text file fname.
'str' 'fname' ['mode'='a']
¶Saves the string str to the text file fname. For parameter mode=‘a’ will append string to the file (default); for mode=‘w’ will overwrite the file. See Scanning file, for sample code and picture.
DAT 'fname' 'dname'
¶mglData
: void
ReadHDF (const char *
fname, const char *
dname)
¶mglDataC
: void
ReadHDF (const char *
fname, const char *
dname)
¶void
mgl_data_read_hdf (HMDT
dat, const char *
fname, const char *
dname)
¶void
mgl_datac_read_hdf (HADT
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.
dat 'fname' 'dname' [rewrite
=off
]
¶mglDataA
: void
SaveHDF (const char *
fname, const char *
dname, bool
rewrite=false
) const
¶void
mgl_data_save_hdf (HCDT
dat, const char *
fname, const char *
dname, int
rewrite)
¶void
mgl_datac_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.
val
'fname' 'dname' [rewrite
=off
]
¶void
mgl_real_save_hdf (real
val, const char *
fname, const char *
dname, int
rewrite)
¶void
mgl_dual_save_hdf (dual
val, const char *
fname, const char *
dname, int
rewrite)
¶void
mgl_int_save_hdf (long
val, const char *
fname, const char *
dname, int
rewrite)
¶Saves value val
named dname to HDF5 file. This function does nothing if HDF5 was disabled during library compilation.
'fname'
¶mglDataA
: int
DatasHDF (const char *
fname, char *
buf, long
size) static
¶int
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.
'fname'
¶mglParse
: void
OpenHDF (const char *
fname)
¶void
mgl_parser_openhdf (HMPR
pr, const char *
fname)
¶Reads all data array from HDF5 file fname and create MGL variables with names of data names in HDF file. Complex variables will be created if data name starts with ‘!’.
const char * const *
mgl_datas_hdf_str (HMPR
pr, const char *
fname)
¶Put HDF data names as list of strings (last one is ""). The result is valid untill next call of the function.
DAT 'fname' 'sch' [v1=0 v2=1
]
¶mglData
: void
Import (const char *
fname, const char *
scheme, mreal
v1=0
, mreal v2=1
)
¶void
mgl_data_import (HMDT
dat, const char *
fname, const char *
scheme, mreal
v1, mreal v2)
¶Reads data from bitmap file (now support only PNG format). The RGB values of bitmap pixels are transformed to mreal values in range [v1, v2] using color scheme scheme (see Color scheme).
dat 'fname' 'sch' [v1=0 v2=0
]
¶mglDataA
: void
Export (const char *
fname, const char *
scheme, mreal
v1=0
, mreal v2=0
, int
ns=-1
) const
¶void
mgl_data_export (HMDT
dat, const char *
fname, const char *
scheme, mreal
v1, mreal 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 Color scheme). If v1>=v2 then the values of v1, v2 are automatically determined as minimal and maximal value of the data array.
dat 'fname' type
¶mglData
: bool
ReadBin (const char *
fname, int
type)
¶int
mgl_data_read_bin (HMDT
dat, const char *
fname, int
type)
¶Reads data from binary file. Parameter type determine the number format: 0 - double, 1 - float, 2 - long double, 3 - long int, 4 - int, 5 - short int, 6 - char. NOTE: this function may not correctly read binary files written in different CPU kind! It is better to use HDF files, see readhdf.