BayES BayES

2.8 Data types and assignments

The previous five sections describe the five data types used by BayES:

  1. matrices

  2. datasets

  3. models

  4. structures

  5. strings

When using assignment statements, BayES infers the type of the item defined from the right-hand side expression. For example, the statement:

s = "Hello from BayES!";

defines a string with id value s and assigns the value "Hello from BayES!" to it. The user does not have to declare s as a string before assigning a value to it: BayES infers that s is a string because the right-hand side expression, "Hello from BayES!", is a string. All functions that operate on strings can be used on s.

Suppose that a subsequent statement in the same script is:

s = [3;2];

This statement redefines s as a 2 ×1 vector and all functions that operate on matrices can be used with s. Furthermore, BayES deletes the value that s had when it was a string from memory without issuing any error or warning. This means that the same id value can be used in a script to represent different data types at different points. At every point, however, an id value can be associated with a single data type and previous definitions are cleared from memory.

Share this content:
Facebook Twitter LinkedIn Email
© 2016–20 Grigorios Emvalomatis