Navigation:  Programmer's Reference > Sending data to DPlot from another application >

ColumnsAre macro command

Print this Topic Previous pageReturn to chapter overviewNext page

Macro commands may be used either in macros or by sending the commands to DPlot via dynamic data exchange (DDE). Some commands are valid only in macros (noted by Macros Only). Commands sent to DPlot via DDE must be enclosed by square brackets [     ]. Macro commands should not include the brackets.

Command parameters shown in the descriptions below are placeholders for the actual values. Command parameters are either numeric values, equations that evaluate to numbers, or character strings. Character string parameters are always bound by double quotation marks. Equations must be preceded by an equals sign (=).

The pipe symbol (|) in the command syntax indicates that a parameter is optional, and should not be included in your macro unless otherwise noted.

All indices into arrays are 1-based, e.g. Curve1=1 refers to the first curve in a plot.

A 0x prefix for numbers in the descriptions below indicates hexadecimal notation; e.g. 0x0010 = 16.

JR/Viewer indicates that the command is supported by DPlot Jr or DPlot Viewer.
JR/Viewer indicates that the command is NOT supported by DPlot Jr or DPlot Viewer.


 

[ColumnsAre(state|,col1,col2,...|)]

JR   Viewer

Determines how the data columns in a multiple column (type D or K, see thorough description in the Open menu command topic.) file are interpreted by a FileOpen command. Optionally allows you to specify which columns from the file are assigned to which arrays.

state


0

XY plot. The first column is assumed to be X and all subsequent columns are assumed to be Y values, 1 curve per column, all sharing the same X. If col1,col2,... are included then col1 specifies the column for the X values.

1

XY plot. Columns are alternating X,Y values, 1 curve for every two columns.

2

XY plot. All columns are assumed to be Y values, 1 curve per column, with X starting at 0 and incremented by 1 for every row.

3

3D surface plot. Default column arrangement is X,Y,Z

The default state is 0 before a macro is run or a DDE conversation is initiated.

For state=0, 2, or 3, you may also specify which columns are assigned to X, Y, and/or Z.

For state=0, col1 specifies the column for the X values and subsequent entries specify Y values, 1 curve per column, that share the same X. For example [ColumnsAre(0,2,1,4)] results in the 2nd column being used for the X axis, the 1st column being used for the Y values of the 1st curve, and the 4th column being used for the Y values for the 2nd curve.

For state=2, col1 specifies the column for the Y values of the 1st curve, col2 specifies the column for the Y values of the 2nd curve, etc. X for both curves will start at 0 and be incremented by 1 for every point.

For state=3, the column numbers should be listed in the order X,Y,Z. You can use the same columns for X and Z or Y and Z, but if the X and Y values are taken from the same column then the 3D "surface" will consist of colinear points and cannot be plotted.

NOTE:

state alone does not determine what type of plot will be produced when opening a file. Multiple column text files are always assumed to hold X,Y data unless a FileType command precedes the FileOpen command. For this reason using state=3 but not also specifying the column arrangement is essentially meaningless.

The settings established by ColumnsAre are turned off after a FileOpen command is processed. So if you want the same settings to be used for multiple files, you must duplicate the ColumnsAre command before each FileOpen.

If you want to turn off the "Specify Columns to Plot" dialog in a ForFilesIn loop, you'll need two instances of ColumnsAre, as in:

FileType(4)

ColumnsAre(0)

ForFilesIn("*.csv")

FileSaveAs("Portable Network Graphics",".png")

FileClose()

ColumnsAre(0)

NextFile

 

 

 

 

 


Page url: https://www.dplot.com/help/index.htm?columnsarecommand.htm