Previous Page Next Page Contents

table -- create a table

Introduction

table() creates a new empty table.

table(index1 = entry1, index2 = entry2...) creates a new table with the given indices and entries.

Call(s)

table()
table(index1 = entry1, index2 = entry2...)

Parameters

index1, index2... - the indices: arbitrary MuPAD objects
entry1, entry2... - the corresponding entries: arbitrary MuPAD objects

Returns

an object of type DOM_TABLE.

Related Functions

_assign, _index, array, assignElements, delete, DOM_ARRAY, DOM_LIST, DOM_TABLE, indexval

Details

Example 1

The following call creates a table with two entries:

>> T := table(a = 13, c = 42)
                                 table(
                                   c = 42,
                                   a = 13
                                 )

The data may be accessed via indexed calls. Note the symbolic result for the index b which does not have a corresponding entry in the table:

>> T[a], T[b], T[c]
                               13, T[b], 42

Entries of a table may be changed via indexed assignments:

>> T[a] := T[a] + 10: T
                                 table(
                                   c = 42,
                                   a = 23
                                 )

Expression sequences may be used as indices or entries, respectively. Note, however, that they have to be enclosed in brackets when using them as input parameters for table:

>> T := table((a, b) = "hello", a + b = (50, 70))
                            table(
                              a + b = (50, 70),
                              (a, b) = "hello"
                            )
>> T[a + b]
                                  50, 70

Indexed access does not require additional brackets:

>> T[a, b] := T[a, b]." world": T
                         table(
                           a + b = (50, 70),
                           (a, b) = "hello world"
                         )
>> delete T:

Example 2

Below, a new table is created implicitly by an idexed assigment using an identifier T without a value:

>> delete T: T[4] := 7: T
                                  table(
                                    4 = 7
                                  )
>> delete T:

Example 3

Use delete to delete entries:

>> T := table(a = 1, b = 2, (a, b) = (1, 2))
                            table(
                              (a, b) = (1, 2),
                              b = 2,
                              a = 1
                            )
>> delete T[b], T[a, b]: T
                                  table(
                                    a = 1
                                  )
>> delete T:

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000