Fisheries and Oceans Canada / Pêches et Océans Canada - Government of Canada / Gouvernement du Canada Fisheries and Oceans Canada / Pêches et Océans Canada - Government of Canada / Gouvernement du Canada
 
Français Contact Us Help Search Canada Site
Home What's New DFO National Site Map Media

Fisheries & Oceans
 
 
Maritimes Region
Fishing Industry
General Public
Marine & Oceans Industry
Media
Students and Teachers
Scientists and Researchers
 
AconIcon ACON       Home/Topics   |   Commands

Data Manipulation


The aggregation commands include: Aggregation Type, Aggregate, Random Points Contours, and Assign.

The NLLS commands include: NLLS, NLLS Correlation, NLLS Delta, NLLS Feasible Region, NLLS Penalty Function, NLLS Iteration Limit, NLLS Parameters and NL2SOL.

Additional minimization commands include: Conj_Grad, and Simplex.

The data modifying commands include: Negate X Axis Data, List Surface, List Tuples, List Contours, Get Picture, Draw Picture, Load Data, Save Data, Save As Metafile, Matrix Write and Tab Table Vectors.


Aggregation


Aggregation Type

This command is used to specify the type of data aggregation to be performed by the Aggregate command. Aggregation produces an aggregate statistic for the z values for each aggregated unit area (if there are only 2 columns of data, the y values are aggregated). The type of aggregate to perform, and the boundary conditions are specified.

There are 3 parameter:s
aggregation type - a character string indicating the type of aggregate statistic to compute. "Total", "Average", "Count", "Min", "Max", "Std. dev.".
x boundary - An optional parameter specifying whether to include the x axis minimum cell boundary as part of the cell
(0 = the minimum is included, the default; 1 = maximum x axis, cell boundary value should be included in the cell).
y boundary - An optional parameter specifying whether to include the y axis minimum cell boundary as part of the cell
(0 = the minimum is included, the default; 1 = maximum yaxis cell, boundary value should be included in the cell).

For example, by default if you aggregate by 5, a data point having an x value of 20, would end up in the cell 20 >= x < 25, resulting in a new averaged x value of 22.5.

Aggregation_Type("aggregation type",[x boundary flag, y boundary flag]);

Aggregation("Total",1,0);

initial program state - there is no initial state


Aggregate

This command is used to aggregate data which is already in memory, into cells. A new syntax version of aggregate is described below. After the data is aggregated, there will likely be fewer data points. The x-axis-cell-width and y-axis-cell-width (optional) are specified. The cell boundaries are aligned to multiples of the cell size; e.g. aggregating by 1.0 will always generate cell boundaries at even 1 unit intervals regardless of the data window, or viewport. The x axis and y axis values are adjusted to the centers of the aggregation unit cells. If the y cell width is not specified, then aggregration occurs over a single dimension (the 1st column of data supplied). The user should take some precaution when aggregating data which has been previously aggregated, rounded or when these data are recorded to a precision which matches the cell size (see below).

There are 2 or more parameters (using the old syntax):
x cell width - the width of the cell along the x axis in
user units.
y cell width -The width of the cell along the y axis in
user units (optional).
xyz matrix - a matrix containing the x, y, and z data as
2 or more columns.
OR
x, y, and z vectors - 2 or more vectors containing the data
to be aggregated.

matrix = Aggregate(xcell width,[y cell width],matrix);

matrix = Aggregate(xcell width,[y cell width],x vector,y vector,z vector);

Aggregate(1,1,mymatrix);
xyz2 = Aggregate(1.0,2.0,xv,yv,zv);
aggregation_Type("Total");
Aggregate(1,shape(4 2,1995 10 1995 20 1995 10 1996 10.))
1995.5 40
1996.5 10

New Aggregate Syntax

A variant of Aggregate() for multiple sort fields, and multiple actions on aggregation objects now exists.

The user should take some precaution when aggregating data which has been previously aggregated, rounded or when these data are recorded to a precision which matches the cell size (see below).

When the following syntax is used, this form of the aggregate command will be used:

Aggregate(grouping object vector[,agg cell width]..."action",object vector...);

The current actions are: TOTAL, SUM, AVERAGE, AVE, AVG, MEAN, COUNT, MIN, MAX, STDDEV, STDEV, %, PERCENT, FIRST, LAST, or function_name (where the named existing user function is of the syntax: name(data_vector,index_vector) and returns an integer or real value. data_vector is the original data vector, index_vector are the indices of subset to be aggregated.).

With this variant of the aggregate command, the grouping objects are NOT adjusted to the cell centers. Standard deviations where the cell count is <2 are returned as NAN.

See the example Aggregated Shading

a few examples may help to clarify this syntax:

year = 95 95 95 95 93 93 93 93 96 96 96
strata = 1 2 4 3 2 2 3 1 4 3 3
set = 1 2 3 4 4 3 2 1 1 2 2
wgt = 1 2 3 4 5 6 7 8 9 10 11
cat(2,year,strata,set,wgt)
95 1 1 1
95 2 2 2
95 4 3 3
95 3 4 4
93 2 4 5
93 2 3 6
93 3 2 7
93 1 1 8
96 4 1 9
96 3 2 10
96 3 2 11
aggregate(year, strata, set, "COUNT", set, "TOTAL", set);
93 1 1 1 1
93 2 3 1 3
93 2 4 1 4
93 3 2 1 2
95 1 1 1 1
95 2 2 1 2
95 3 4 1 4
95 4 3 1 3
96 3 2 2 4
96 4 1 1 1
aggregate(year, 2, "COUNT", set, "TOTAL", set, "AVERAGE", wgt);
92 4 10 6.5
94 4 10 2.5
96 3 5 10.0
aggregate(year,set);
93 1
93 2
93 3
93 4
95 1
95 2
95 3
95 4
96 1
96 2
aggregate(year, "COUNT", set,"FIRST", set, "LAST", set);
93 4 4 1
95 4 1 4
96 3 1 2

The following example uses 2 user-defined functions to count the occurances of 0´s and 1´s within an aggregated data set:

/* random numbers for the example */
x = -60. + rand(shape(20,3));
y = 43. + rand(shape(20,3));
z = rand(shape(20,1));
print(cat(2,x,y,z))
-60 44 1
-58 44 1
-60 46 1
-60 43 1
-59 46 0
-57 43 1
-57 45 1
-60 43 1
-60 43 0
-58 45 1
-59 45 1
-60 46 0
-58 46 1
-59 43 1
-59 43 1
-58 45 0
-57 44 0
-59 45 0
-60 43 0
-59 44 1
/* Function to count how many z´s are 0 */
Function Count0(d,ind) {
return(sum(d[ind] == 0.0));
};
/* Function to count how many z´s are 1 */
Function Count1(d,ind) {
return(sum(d[ind] == 1.0));
};
Aggregate(x, 1, y, 1, "Count0", z,"Count1", z);
-60 43 2 2
-60 44 0 1
-60 46 1 1
-59 43 0 2
-59 44 0 1
-59 45 1 1
-59 46 1 0
-58 44 0 1
-58 45 1 1
-58 46 0 1
-57 43 0 1
-57 44 1 0
-57 45 0 1

Take care in Aggregating rounded data

The user should take some precaution when aggregating data which has been previously aggregated, rounded or when these data are recorded to a precision which matches the cell size. This is due to errors that may result in aggregation when the precision of the input data are less that that used to bin data into the appropriate cells.

For example, if a coordinate of 40 deg, 20 min N has been transformed into a decimal value and then stored as an ASCII value with 6 decimal places precision, the value would be:
40.333333
while a value of 40 deg, 40 min N would be recorded commonly as
40.666667

These precisions are less than the machine precision used to aggregate the data. The 2nd value is likely to be allocated to the incorrect cell if the data are aggregated into a cell size that is divisable by these values e.g. 10/60.

In cases where you know that the data is recorded to a fixed precision fraction of the cell size,
e.g. degree, minutes data originally recorded to the nearest 1 minute as 40.666667,
you can avoid this problem by moving the data to the center of the ´cell´ before aggregation.

xyzagg = Aggregate(x + 1/120.,1/60. y + 1/120.,1/60. "Total",catch);

where 1/120. of a degree will shift values into the center of a cell of size 1/60. degrees.
If your data permit, letting ACON calculate the decimal values internally would avoid these rounding errors
e.g. xyzagg = Aggregate(xdeg + xmin/60.,1/60. ydeg + ymin/60.,1/60. "Total",catch);


Random Points Contours

This command is used to generate a list of pseudorandom station locations within each contour level of the contoured data. The contour levels must already be defined before this command will execute. A Starting Seed for the random number generator must be supplied which ensures that the random number sequence is not repeated (0-32767). It is the user´s responsibility to maintain a unique series of starting seeds. The number of points to be generated for each contour interval must also be specified.

The list of random locations is printed as:

x_position, y_position, point_sequence_#, contour_level_index

where point_sequence_#´s range from 1...total # of points, and the 1st "n" sequence_#´s fall within the 1st contour level, etc.

There are 3 or more parameters:
starting seed - the random number generator seed.
leveln points - the number of random numbers to generate within the nth contour level.
xyz matrix - a matrix containing the x, y, and z data as 3 columns

OR
x, y and z vectors - 3 vectors containing the xyz data.

Random Points Contours(starting seed,# Pts level 1,...[# Pts level n], xyz matrix);

Random Points Contours(starting seed,# Pts level 1,...[# Pts level n], x vector, y vector, z vector);

Random_Points_Contours(596,20,20,20, xyz_matrix);


Assign

This command is used to create a named variable from an object on the execution stack.

There are 2 parameters:
object name - the name of the object to be created.
object - the object for which a name is to be assigned.

Assign(parameter name,object);

for($i=1;$i<=3;$i++) { $name = sprintf("P%01d",$i); assign($name,{ push_stack(times,$i,4);execute(3); });}


Pop Stack

This command is used to remove objects from the execution stack.

There is 1 parameter:
number of elements - the number of objects which are to be poped from the stack.

Pop_Stack(1);

5; pop_stack(1);


Push Stack

This command is used to add objects to the execution stack.

There are 1 or more parameters:
object - the object which is to be pushed onto the stack.

Push_Stack(object);

push_stack(3 * 4);


Non-linear Fitting


NLLS

This command is used to fit a Non-linear Least Squares (NLLS) function to a set of data.

There are 7 parameters:
model name - the name of the model to use to estimate the parameters. This may be a built-in function e.g. Qeos, PQeos, or an user-defined function.
par - the numeric vector containing the initial estimates of the parameter values.
resid - the numeric vector containing the residuals from the final parameter estimate.
parout - the numeric vector containing the final parameter estimates.
seout - the numeric vector containing the final standard error estimates.
biasout - the numeric vector containing the final parameter bias estimates, if this is a null object, no bias calculations are performed.
prflag - a flag indicating the amount of detail to be reported during the analysis:
0 = no reporting, 1 = print lambda, 2 = reason for termination, 4 = mean square residuals, 8 = parameter estimates, 16 = correlation matrix.
Any subset of these reporting flags may be summed to report a number of results simultaneously.

NLLS("modelname", par, resid, parout, seout, biasout, print_flag);

qest = shape(ntune,0.0);
partem = shape(scalar(len(fagi)),0.3);
fest1 = out_prod(selmod,shape(len(est_yrs),0.3));
vdat = rvall[indxages;]; /* age 1 indexed rv */
resid = shape(len(ravel(vdat)),0.0);
parout = seout = biasout = partem;
Qeos(caa,wtjl,selmod,vcode,vdat,maa,fagi,logflag,pop,fmat,bmat,par,qest,resid,oldagei,yrfrac,vpaflag);
NLLS("Qeos", partem, resid, parout, seout, biasout, prflag);

See the example NLLS


NLLS Correlation

This command is used to calculate the Non-linear Least Squares (NLLS) parameter estimates and bias calculations and the correlation matrix.

There are 7 parameters:
model name - the name of the model to use to estimate
the parameters. This may be a built-in function e.g. Qmodel, PQmodel, or an user-defined function.
parout - the numeric vector containing the final parameter
estimates.
resid - the numeric vector containing the residuals from
the final parameter estimate.
parseflag - Obsolete - enter 0.
seout - the numeric vector containing the final std
error estimates.
biasout - the numeric vector containing the final
parameter bias.
prflag - a flag indicating the amount of detail to be
printed (see NLLS).
The correlation matrix is returned as a numeric matrix.

m = NLLS_Correlation("modelname", parout, resid, parseflag, seout, biasout, print_flag);

qest = shape(ntune,0.0);
partem = shape(scalar(len(fagi)),0.3);
fest1 = out_prod(selmod,shape(len(est_yrs),0.3));
vdat = rvall[indxages;]; /* age 1 indexed rv */
resid = shape(len(ravel(vdat)),0.0);
parout = seout = biasout = partem;
Qeos(caa,wtjl,selmod,vcode,vdat,maa,fagi,logflag,pop,fmat,bmat,par,qest,resid,oldagei,yrfrac,vpaflag);
NLLS("Qeos", partem, resid, parout, seout, biasout, prflag);
m = NLLS_Correlation(" Qeos", parout, resid,0 , seout, biasout, prflag);

See the example NLLS


NLLS Delta

This command is used to set the delta (difference value) for the Non-linear Least Squares (NLLS) function to establish the precision in difference calculations.

There is 1 parameter:
delta - the new value of the difference. The default is
(ABS(parami) + sqrt(DBL_EPSILON)) * sqrt(DBL_EPSILON)

NLLS_Delta(difference value);

NLLS_Delta(0.001);

See the example NLLS


NLLS Iteration Limit

This command is used to set the iteration limit for the Non-linear Least Squares (NLLS) function to iteratively attempt to reach a converged solution.

There is 1 parameter:
limit - the new value of the iteration limit. The default is 20.

NLLS_Iteration_Limit(limit);

NLLS_Iteration_Limit(30);

See the example NLLS


NLLS Parameters

This command is used to set the names of the parameters for the Non-linear Least Squares (NLLS) function.

There is 1 parameter for each NLLS parameter: each parameter is a character string providing the parameter name.

NLLS_Parameters("name",...);

NLLS_Parameters("f2","f3","f4");

See the example NLLS


NL2SOL

NL2SOL is an Adaptive Nonlinear Least-Squares Algorithm. The package NL2SOL (TOMS algorithm 573) uses a hybrid combination of G-N and estimation of a positive-definite approximation to the Hessian from differences of first derivatives.

There are 6 parameters:
model name - the name of the model to use to estimate
the parameters. This may be a built-in function e.g. Qeos, or an user-defined function.
par - the numeric vector containing the initial estimates
of the parameter values.
resid - the numeric vector containing the residuals from
the final parameter estimate.
iv - numeric integer vector for storing internal NL2SOL
initial conditions (length is the number of parameters + 60).
v - numeric real vector for storing internal NL2SOL
calculations (length is 93 + number of residuals*(number of parameters +3) +
number of parameters *(3*number of parameters + 33)/2).
im - optional initialization matrix (shape n x 2) used
to override any initialization values. Column 1 contains the index of the initial condition to set, and column
2 contains the initial value.

NL2SOL("modelname", par, resid, iv, v, [initialization matrix]);

/* example extalk syntax: */
NL2SOL("modelname", par, resid, iv, v,[initialization matrix]);

NLLS Penalty Function

This command is used to establish the name of the user-defined function which will return the penalty for choosing a given parameter set when executing the Non-linear Least Squares (NLLS) function. The default penalty function sets the penalty to 0.

There is 1 parameter:
penalty fn name - a character string providing the penalty
function name.

NLLS_Penalty_Function("name");

NLLS_Penalty_Function("mypenalty");
/* where the function has the form */
Function mypenalty(par,npar) {
/* par - the current set of parameter values from NLLS */
/* npar - the number of parameters passed */
/* return the penalty value */
return(1.0);
};

NLLS Feasible Region

This command is used to establish the name of the user-defined function which will return the feasible region indicator for choosing a given parameter set when executing the Non-linear Least Squares (NLLS) function. The default feasible region function constrains the feasible region to positive parameter values (returns 1 when all parameters are positive).

There is 1 parameter:
feasible region fn name - a character string providing the
feasible region function name.

NLLS_Feasible_Region("name");

NLLS_Feasible_Region("myfeasibleregion");
/* where the function has the form */
Function myfeasibleregion(par,npar) {
/* par - the current set of parameter values from NLLS */
/* npar - the number of parameters passed */
/* return the feasible region value (0 or 1) */
return(1);
};

Conj_Grad

This command is used to minimize a function using the Polak-Ribiere conjugate gradient method. The number of iterations are returned as the result.

The algorithm for this function is from Chapter 10.6 Conjugate Gradient Methods in Multidimensions pages 317-322 of Numerical Receipes in C The Art of Scientific Computing. 1988. W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling. Cambridge University Press Cambridge, 735 p.

There are 5 parameters:
function name - the name of the user-defined function
to evaluate. This function takes a single parameter, the real vector of parameter values to use, and returns a residual value.
derrivative function name - the name of the user-defined
function which calculates the gradient.
This function takes 2 parameters, the real vector of parameter
values to use, and the vector of gradients to calculate.
par - the numeric vector containing the initial estimates
of the parameter values.
parout - the numeric vector containing the final estimates
of the parameter values.
prflag - an optional flag indicating the amount of detail
to be reported during the analysis: 0 = no reporting (default), 1 = show iterations.

niter = Conj_Grad("function_name", "derrivative_function_name", par, parout, print_flag);

//---------------------------------------------------
// Test code using a cubic function
//---------------------------------------------------
function cuub(x,p)
{ return(p[1] + ( p[2] * x) + (p[3] * x * x) + (p[4] * x * x* x))
}

function func(p)
{ s = sum(fabs(ydata - cuub(xdata,p)));
return(s);
}

function dfunc(p,xi)
{ for($i = 1; $i <= len(p); $i++)
{ pt = p;
pt[$i] += 0.001;
xi[$i] = -1. * (func(pt) - func(p))/.001;
};
}

xdata = seq(1.,10.);
ptru = 10.0 1.0 2.0 -1.0;
ydata = cuub(xdata,ptru);
print(func(ptru));
xi = ptru * 0.;
print(dfunc(ptru,xi));
print(xi);
// Using Conjuate Gradient method
res = shape(len(ptru),0.);
niter = conj_grad("func", "dfunc", 1. 1 1 1, res, 1);
print(cat(1,ptru,res));
line_colour("Green");
ytest = cuub(xdata,res);
plot_lines(xdata,ytest,0,10,-800,50);
// True line;
line_colour("Black");
plot_lines(xdata,ydata,0,10,-800,50);

Simplex

This command is used to minimize a function using the Nelder and Mead downhill simplex method. The number of iterations are returned as the result.

The algorithm for this function is from Chapter 10.4 Downhill Simplex Method in Multidimensions pages 305-309 of Numerical Receipes in C The Art of Scientific Computing. 1988. W.H. Press, B.P. Flannery, S.A. Teukolsky, and W.T. Vetterling. Cambridge University Press Cambridge, 735 p.

There are 2 or more parameters:
function name - the name of the user-defined function
to evaluate. This function takes a single parameter, the real vector of parameter values to use, and returns a residual value.
vertices - the numeric matrix [ndim+1;ndim] containing
the vertices of the starting simplex.
ftol - the numeric tolerance value for determining convergence.
The default is 1.0E-6.
prflag - an optional flag indicating the amount of detail
to be reported during the analysis: 0 = no reporting (default), 1 = show iterations.

niter = Simplex("function_name", vertices, print_flag);

//---------------------------------------------------
// Test code using a cubic function
//---------------------------------------------------
function cuub(x,p)
{ return(p[1] + ( p[2] * x) + (p[3] * x * x) + (p[4] * x * x* x));
};

function func(p)
{ s = sum(fabs(ydata - cuub(xdata,p)));
return(s);
};

function dfunc(p,xi)
{ for($i = 1; $i <= len(p); $i++)
{ pt = p;
pt[$i] += 0.001;
xi[$i] = -1. * (func(pt) - func(p))/.001;
}
};

xdata = seq(1.,10.);
ptru = 10. 1. 2. -1.;
ydata = cuub(xdata,ptru);
print(func(ptru));
xi = ptru * 0.;
print(dfunc(ptru,xi));
print(xi);
// Using Simplex method
vert = shape(5 4,0 0 0 0 12 0 0 0 0 2 0 0 0 0 1 0 0 0 0 1.);
niter = Simplex("func",vert,1);
line_colour("RED");
yvalues = cuub(xdata,vert[1;]);
plot_lines(xdata,yvalues,0,10,-800,50);
// True line
line_colour("Black");
plot_lines(xdata,ydata,0,10,-800,50);

Modifying Data


Negate X Axis Data

This command is used to negate the x axis data after it has been read into memory. When this program is used to plot geographic data in the western hemisphere (as is likely to be the case), the x axis data (longitude) must be specified as negative values (west of the Greenwich meridian) to maintain the proper left-right orientation. If your data file does not contain negative longitude values (a reasonable assumption) you may use this command to convert the x axis coordinate values to negative numbers after they have been read into memory.

Note: - If the Mercator projection option is active, then the program will ignore the negative values in the x axis when labelling the axis values. The data window must still be specified using negative longitudes for areas in the western hemisphere.

Parameters:
x vector - vector containing the data to negate. Note: this command will not negate a subscripted matrix.

Negate_X_Axis_Data(vector);

Negate_X_Axis_Data(x_vector);

List Surface

This command is used to list the delaunay triangle x,y,z values for each vertice of each triangle to the output text window.

Parameters:
xyz matrix - a matrix containing the x, y, and z data as 3 columns.

OR
x, y, and z vectors - 3 vectors containing the data to be listed.

List_Surface(xyz matrix);
List_Surface(x,y,z vectors);

List_Surface(x,y,z);

List Tuples

This command prints the data tuples to a text editor window (or output file). The data tuples are the indicies of the data points used to form the Delaunay triangles.

Parameters:
xyz matrix - a matrix containing the x, y, and z data as 3 columns.

OR
x, y, and z vectors- 3 vectors containing the data to be listed.

list_tuples(xyz matrix);
list_tuples(x,y,z vectors);

list_tuples(mymatrix);
list_tuples(x,y,zv);
1 3 4 <= indicates data points 1, 3, and 4 form the vertices of a delaunay triangle
2 1 3
...
5 9 6

List Contours

This command returns the x,y,z coordinates of the contour line endpoints for each delaunay triangle. Paired starting and ending coordinates will be adjacent.
The data_contours_levels() command must be executed previously, to define the data levels at which contours are to be generated.

Parameters:
xyz matrix - a matrix containing the x, y, and z data as 3 columns.

OR
x, y, and z vectors- 3 vectors containing the data to be listed.

list_contours(x,y,z or matrix)

x = -67 -65 -66 -64.;
y = 44 45 43. 44 ;
z = 10 15 12. 16 ;
Data_Contour_Levels(10 ,0.2 ,12 ,0.4 ,14 ,0.8 );
list_contours(x,y,z);
Warning: Data_Window not set before forming Delaunay Triangles
2 tuples formed
0 triangles contain blanking points
0 triangles exceeded length limit
-67.0 44.0 10
-66.2 44.4 12
-66.0 44.0 12
-65.4 44.8 14
-65.0 44.0 14
-67.0 44.0 10
-66.0 43.0 12
-66.0 44.0 12
-65.0 44.0 14
-65.0 43.5 14

Get Picture

This command captures a bitmap object from the screen. This bitmap object may be subsequently drawn using the Draw_Picture command. When the bitmap is captured, the current Data_Window() and Data_Viewport() are stored along with the graphics, and restored when the Draw_Picture() is issued.
Note that you can save the picture object using the Save_Data() command, but that does not create a standard windows bitmap file as a result.

There are no parameters.

Get_Picture();

my_pict = Get_Picture();
Draw_Picture(my_pict);


Draw Picture

This command draws a bitmap object to the screen. The bitmap object must have been previously created using the Get_Picture command.

There are 1 or 5 parameters:
bitmap object - the picture to be drawn.
left - the position of the left edge of the picture on the screen in NDCs.
right - the position of the right edge of the picture on the screen in NDCs.
bottom - the position of the bottom edge of the picture on the screen in NDCs.
top - the position of the top edge of the picture on the screen in NDCs.

Draw_Picture(picture [,left,right,bottom,top]);

my_pict = Get_Picture();
Draw_Picture(my_pict);


Load Data

This command is used to load a data object which has been stored in an ACON binary object file. Currently, the types of objects which may be stored in an ACON binary object file are vectors, matrices, and bitmaps [from Get_Picture()]. The object stored in the file is read into memory and assigned the name which it had when it was originally stored in the binary file. The name of the stored object is returned as a character string from the command so that a user function can obtain the actual object name. Note that Overlay_File()s are a stored in a special binary format, not available using the Load_Data() command.

There is 1 parameter:
filename - the Path/Filename of the data file to read.

name = Load_Data("Filename");

Load_Data("myfile");

Save Data

This command is used to save a data object in an ACON binary object file. Currently, the types of objects which may be stored in an ACON binary object file are scalars, vectors, matrices and bitmaps [from Get_Picture()]. The object is written to the file is as well its name.

There are 2 parameters:
filename - the Path/Filename of the data file to create.
objectname - the name of the data object to save.

Save_Data("Filename", "objectname");

Save_Data("myfile","myobject");

Save As Metafile

This command is used to save the graph window as a Windows Graphics Metafile (WMF).

There is 1 parameter:
filename - the Path/Filename of the WMF file to save the graph
window in.

Note :
If called without parameters, when run on the GUI version, this command will pop up a dialog window where the user can type the name of the WMF file to save.
See Acon GUI Functionalities for more details.

Save_As_Metafile("Filename");

Save_As_Metafile ("C:\WINDOWS\DESKTOP\myfile.wmf");

Matrix Write

This command is used to write an ASCII tab delimited file containing the user´s numeric data from a vector, matrix, or 3D matrix. The data may be read back into memory using the Matrix_Read() command.
The ´pages´ of a 3D matrix are delimited in the file by blank lines. When a 3D matrix is re-read using the Matrix_Read() command, these blank lines will be embedded into the 2D object that is created, as rows of 0´s.

There are 3 parameters:
file name - the name of the data file to create.
variable name - the data object to save.
decimal digits - the optional number of decimal digits
to use when writing the data.

Matrix_Write("file name", variable[,decimal digits]);

Matrix_Write("MyDataFile",x);

Tab Table Vectors

This command is used to create a tab-delimited table from vector data.
It creates an output file from existing data in memory. This function needs 3 arguments, the filename, column titles and decimals.

There are 3 parameters:
Filename - the name of the output file to be created.
Filename is optional, which produces output to the screen if absent.
Column titles - char matrix of names of vectors to use as
data columns. They are optional.
Decimals - integer vector of decimal digits for columns.
They are optional (and apply to real vectors only). you can omit the titles, and still supply the decimal digits vector.

Tab_Table_Vectors("file name", names, variable [, decimal digits]);

length = 1 2 3;
weight = 10 20 30;
age = 5 6 6;
tab_table_vectors("myoutputfile", strfold("length weight age"));


AconIcon ACON       Home/Topics   |   Commands



Last Modified : 2005-11-12