Data Table Component - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Document Tools : Embedded Components : DataTableComponent

Data Table Component

Insert a one- or two-dimensional data table in a Standard Maple worksheet or document.

 

Description

Component Palette Image

DataTable Properties

Data Table Example

Description

• 

The data table component performs an action or a series of actions to communicate with other embedded components when the data table is updated, although assigning an action to a component is not required.

• 

The data structure used to store the data is an rtable.

• 

You can insert this embedded component from the Components palette.

• 

There are three ways to populate the data table with entries:

1. 

By referencing the name of an existing Matrix, Array, Vector, or other rtable

2. 

By filling in the initial values interactively

3. 

By importing the initial values from a file

 

Associating the data table with an existing Matrix

If you have already defined a Matrix, Array, Vector, or other rtable in your document, you can associate the data table with that rtable.  The rtable must be assigned to a name.  

To associate the data table with an existing Matrix: 

1. 

Insert the Data Table Component from the Components palette.

2. 

Select Use existing Matrix.

3. 

Select the name of the rtable from the drop-down list.

Filling in data table values interactively

To fill the initial values interactively: 

1. 

Insert a Data Table Component.

2. 

Select Create new Matrix and specify a variable name for the rtable.  

3. 

Specify the total number of rows and columns of the rtable.  

4. 

Set other properties, as desired, and then click OK.  The component is inserted in the document with initial values of 0.  

5. 

Double-click each table cell to edit the value.

 

Importing data table values from a file

To import the initial values from a file:

1. 

Insert a Data Table Component.

2. 

Select Import Matrix and specify a variable name for the rtable.

3. 

Click OK.  

The Data Import Assistant dialog opens. This dialog is an interactive interface that allows you to import data into Maple.

4. 

In the Data Import Assistant dialog, browse to the location of the file you want to import data from, select the file, and then click Next.

Note: The following file formats are supported: Excel®, MATLAB®, Image, Audio, Matrix Market, Comma Separated Values, and Delimited

5. 

Set the appropriate import options for your data and, optionally, preview your data within the Data Import Assistant dialog.

6. 

Click Done to close the Data Import Assistant and import the data into the Data Table Component.

 

• 

To perform an action when the data table is updated, right-click (Control-click for Macintosh) the data table, and then select Edit Content Changed Action to open the Code Editor dialog for the data table. Enter the commands you want to perform in the Code Editor dialog. For more information, see the Data Table Example on this page.

• 

The data table component is customized by setting options in the DataTable Properties. To display DataTable Properties, right-click (for Macintosh, Control-click) the data table and select Component Properties. Actions are associated with components using routines in the DocumentTools package.

• 

The column widths can be set interactively by dragging the column boundaries or programmatically as described in the DataTable Properties section below.

• 

The Component Name property is used to reference the data table when using the routines from the DocumentTools package.

• 

To force an update of the data table, use DocumentTools[SetProperty]("DataTable0",update), where DataTable0 is the name of your data table.

Component Palette Image

DataTable Properties

• 

The following table describes the control and use of the data table component options.

  

An x in the G column indicates that the option can be read, that is, retrieved by using the DocumentTools[GetProperty] tool.

  

An x in the S column indicates that the option can be written, that is, set by using the DocumentTools[SetProperty] tool.

                    Option   G  S  Option Type                       
  
tooltip  x  x  string        

variableName  x  x  name               
visibleRows  x  x  positive integer  

visibleColumns  x  x  positive integer     

enabled  x  x  true or false

visible  x  x  true or false

editable  x  x  true or false  

columnNames  x  x  list of strings   

   rowNames  x  x  list of strings   

rowHeader  x  x  true or false   

columnHeader  x  x  true or false      

   columnWidths     x  list of integers      

  

                                

  

tooltip

  

The text that appears when the user hovers the mouse over the data table.

  

variableName

  

The variable that the data table is associated with. This may be a previously defined variable that has a Matrix, Vector, or Array assigned to it, or it may be a new variable that was created when the data table was created.

  

visibleRows

  

The number of visible rows in the data table.

  

visibleColumns

  

The number of visible columns in the data table.

  

enabled

  

Indicates whether the data table component is enabled. If enabled is set to false, it will not receive updates when the Matrix, Vector, or Array assigned to the variable changes. In other words, it will be a snapshot in time that will not be updated. By default, the value is true.

  

visible

  

Specifies if the data table is visible. By default, the value is true.

  

editable

  

Indicates whether the table cells are editable. By default, the value is true.

  

columnNames

  

Specify names for the columns of the table.

  

rowNames

  

Specify names for the rows of the table.

  

rowHeader

  

Specifies if the names for the rows of the table are visible.

  

columnHeader

  

Specifies if the names for the columns of the table are visible.

  

columnWidths

  

Specify widths (in pixels) for the columns of the table. The column widths have to specified as a list. For example:

  

SetProperty("DataTable0",columnWidths, [20, 20, 20, 20]);

  

 

Data Table Example

Note: To interact with the examples provided below, open this help page as a worksheet and then execute the worksheet.

This example uses a DataTable component to display a set of points on a Plot component.

To insert the DataTable and Plot components using the Components palette:

1. 

Click on the DataTable icon in the Components palette.

2. 

In the Create Data Table dialog:

• 

Select Create new Matrix

• 

Set Total Columns and Visible Columns to 2

• 

Set Total Rows and Visible Rows to 7

• 

Click OK to close the Create Data Table dialog

Note: To change Row Name and Column Name, right-click (Control-click for Macintosh) the data table, and then select Component Properties.

3. 

Click on the Plot icon in the Components palette to insert the component.

For information on displaying the Maple palettes, see the Show Palettes help page.

 

To display the points in data table on the Plot component:

1. 

Right-click (Control-click for Macintosh) the DataTable component, and then select Edit Content Changed Action.

This launches a dialog with preset statements and additional information on how to program actions between embedded components.

2. 

Before the end use; statement in the dialog, enter the following command:

SetProperty( "Plot0", 'value', plots:-pointplot( eval( parse( GetProperty("DataTable0", 'variableName') ) ), 'color'=red ) );

Note: Ensure the names of the components are correct (that is, that they match the Name fields of their components).

3. 

From the File menu, select Save Code to accept all changes.

4. 

From the File menu, select Close Code Editor.

5. 

Enter the points in the data table and press Enter to generate a display on the Plot component (the points in this data table are for y= x2).

 

Note: You can also use the data table to display points on a 3-D plot.

To do that:

• 

 Create a data table with 3 columns instead of 2.

• 

 In the code editor for data table, write the following command instead:

SetProperty( "Plot0", 'value', plots:-pointplot3d( eval( parse( GetProperty("DataTable0", 'variableName') ) ), 'color'=red ) );

  

 

  

You can verify the syntax of the embedded component action by executing these commands in the worksheet in which you have defined the embedded components.

with(DocumentTools):

MyData:= eval(parse(GetProperty("DataTable0",'variableName')));

SetProperty( "Plot0", 'value', plots:-pointplot( eval( parse( GetProperty("DataTable0", 'variableName') ) ), 'color'=red ) );

See Also

ButtonComponent

CheckBoxComponent

ComboBoxComponent

Data Import Assistant

DialComponent

DocumentTools

DocumentTools[Do]

DocumentTools[GetProperty]

DocumentTools[SetProperty]

EmbeddedComponents

LabelComponent

ListBoxComponent

MathExpressionComponent

MeterComponent

PlotComponent

RadioButtonComponent

RotaryGaugeComponent

SliderComponent

TextAreaComponent

ToggleButtonComponent

VideoPlayerComponent

VolumeGaugeComponent

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam