LyME-specific Functions

axis

Set the scale of the next graphic.

Syntax

axis([xmin,xmax,ymin,ymax])
axis equal

Description

The axis command, which should be placed before any other graphic command, sets the scale and scale options. The parameter is either a vector of 4 elements which sets the limits of the plot for both x and y axis, or the string 'equal' to make the scale equal in both directions so that circles are really displayed as circles and not ellipses.

See also

clf, hold

bar

Vertical bar plot.

Syntax

bar(y)
bar(x, y)
bar(x, y, w)
bar(..., kind)
bar(..., kind, color)

Description

bar(x,y) plots the columns of y as vertical bars centered around the corresponding value in x. If x is not specified, its default value is 1:size(y,2).

bar(x,y,w), where w is scalar, specifies the relative width of each bar with respect to the horizontal distance between the bars; with values smaller than 1, bars are separated with a gap, while with values larger than 1, bars overlap. If w is a vector of two components [w1,w2], w1 corresponds to the relative width of each bar in a group (columns of y), and w2 to the relative width of each group. Default values, used if w is missing or is the empty matrix [], is 0.8 for both w1 and w2.

bar(...,kind), where kind is a string, specifies the kind of bar plot. The following values are recognized:

'grouped'Columns of y are grouped horizontally (default)
'stacked'Columns of y are stacked vertically
'interval'Same as grouped, except that bars have min and max values

With 'interval', intervals are defined by two consecutive rows of y, which must have an even number of rows.

The optional argument color is a string made of one or several color characters:

'k'black
'w'white with a black frame

First color is applied to first row of y, second color to second row, and so on; if there are less colors than rows, colors are recycled.

Examples

bar([2,4,3,6;3,5,4,1]);                       % simple bar plot
bar(1:4, magic(4), [], 'stacked');            % stacked bar plot
bar(1:4, [2,4,3,1;5,6,4,6], [], 'interval');  % interval plot

See also

barh, plot

barh

Horizontal bar plot.

Syntax

barh(x)
barh(y, x)
barh(y, x, w)
barh(..., kind)
barh(..., kind, style)

Description

barh plots a bar plot with horizontal bars. Please see bar for a description of its behavior and arguments.

Examples

barh([2,4,3,6;3,5,4,1]);                       % simple bar plot
barh(1:4, magic(4), [], 'stacked');            % stacked bar plot
barh(1:4, [2,4,3,1;5,6,4,6], [], 'interval');  % interval plot

See also

bar, plot

beep

Play music.

Syntax

beep(freq)
beep([freq, duration])
beep([freq, duration, volume])

Description

The beep command plays one or several sounds. Argument is a m-by-n matrix, with n between 1 and 3; first column is the frequency in Hertz, second column is duration in seconds (default 0.1), and third column is volume between 0 and 1 (default 1).

Example

beep(440 * 2.^((0:12)'/12));

clc

Clear the console (output) window.

Syntax

clc

See also

clf, close

clf

Clear the figure window.

Syntax

clf

See also

close, clc, hold, plot

close

Discard the graphic output and display the text output window.

Syntax

close

See also

clf, clc

contour

Level curves.

Syntax

contour(z)
contour(z, [xmin, xmax, ymin, ymax])
contour(z, [xmin, xmax, ymin, ymax], levels)

Description

contour(z) plots seven contour lines corresponding to the surface whose samples at equidistant points 1:size(z,2) in the x direction and 1:size(z,1) on the y direction are given by z. Contour lines are at equidistant levels. With a second non-empty argument [xmin, xmax, ymin, ymax], the samples are at equidistant points between xmin and xmax in the x direction and between ymin and ymax in the y direction. The optional third argument levels, if non-empty, gives the number of contour lines if it is a scalar or the levels themselves if it is a vector.

Example

u = -2 + (0:40) / 10;
x = repmat(u, 41, 1);
y = x';
z = exp(-((x-0.2).^2+(y+0.3).^2)) ...
      - exp(-((x+0.5).^2+(y-0.1).^2)) + 0.1 * x;
scale('equal');
contour(z, [-1,1,-1,1]);

See also

plot

dbcloserec

Close a database record.

Syntax

dbcloserec(fd)

Description

dbcloserec(fd) terminates the access to a record which was opened with dbnewrec or dbopenrec. The file descriptor fd cannot be used anymore.

See also

dbnewrec, dbopenrec

dbdelrec

Open an existing database record.

Syntax

dbdelrec(dbName, index)
dbdelrec(dbName, index, delBackup)

Description

dbdelrec(dbName,index)(fd) deletes a record from the database identified by its name dbName. The record itself is identified by its index; the first record has index 0.

With a third argument delBackup, dbdelrec marks the record as deleted, so that the record will also be deleted from the backup the next time the Palm device is synchronized.

See also

dbdir, dbnumrec

dbdir

Close a database record.

Syntax

dbdir
dbdir('type')
dbdir('type/creator')
dblist = dbdir(...)

Description

dbdir displays the list of databases with their types and creators. Types and creators are strings of four characters; the type characterizes the kind of data, and the creator identifies the application which owns the database. Without argument, databases with type 'appl', 'libr', 'neti', 'ovly', or 'panl' are not displayed.

To filter the databases which are displayed, a string argument may be provided. It contains the type, and optionally a slash character and the creator. The type or the creator can be replaced with the star character, which stands for any value.

With an output argument, dbdir returns a list of structures with fields name, type, and creator.

Examples

dbdir('DATA')
  AddressDB  DATA/addr
  DatebookDB  DATA/date
  MailDB  DATA/mail
  MemoDB  DATA/memo
  ConnectionDB  DATA/modm
  NetworkDB  DATA/netw
  ToDoDB  DATA/todo
db = dbdir('*/LyME');
dumpvar('db1', db{1});
  db1 = struct('name','LyMELibDB', ...
  'type','Lml ', ...
  'creator','LyME');

See also

dbnumrec

dbnewrec

Create a new database record.

Syntax

fd = dbnewrec(dbName)
(fd, index) = dbnewrec(dbName)

Description

dbnewrec(dbName)(fd) adds a new record to the database identified by its name dbName. It returns a file descriptor which should be saved and used with functions such as fprintf and fwrite. Once the record is written, dbclose should be called to terminate the record creation.

The second output argument, if present, is set to the index of the record. The first record has index 0.

Example

Creation of a new note for the Memo Pad application. Note that the record ends with a null byte.

fd = dbnewrec('MemoDB');
fprintf(fd, 'Sine between 0 and 90 deg\n');
for a = 0:15:90
  fprintf(fd, 'sin(%d) = %g\n', a, sin(a));
end
fwrite(fd, 0);
dbcloserec(fd);

See also

dbcloserec, dbopenrec

dbnumrec

Number of records in a database.

Syntax

n = dbnumrec(dbName)

Description

dbnumrec(dbName)(fd) gives the number of records in the database identified by its name dbName.

See also

dbdir

dbopenrec

Open an existing database record.

Syntax

fd = dbopenrec(dbName, index)

Description

dbopenrec(dbName,index)(fd) opens a record from the database identified by its name dbName. The record itself is identified by its index; the first record has index 0. dbopenrec returns a file descriptor which should be saved and used with functions such as fgets, fscanf and fread. Once the record has been read, dbclose should be called.

Example

Reading of the first line of the first note for the Memo Pad application.

fd = dbopenrec('MemoDB', 0);
line = fgetf(fd);
dbcloserec(fd);

See also

dbcloserec, dbnewrec

hold

Graphic freeze.

Syntax

hold on
hold off

Description

Command hold controls whether the graphic window is cleared before graphic commands such as plot and text display new elements. hold on suspends the auto-clear feature, and hold off resumes it. In any case, clf always resumes it.

Example

t = 0:0.1:2*pi;
plot(t, sin(t));
hold on;
plot(t, cos(t));
hold off;
pause(3);
plot(t, sin(t).*cos(t));

See also

plot, clf

loglog

Generic plot with a logarithmic scale along x and y axis.

Syntax

loglog(y)
loglog(x, y)
loglog(x, y, style)

Description

Command loglog is similar to plot, except that the scale along both x and y axis is logarithmic.

See also

plot, semilogx, semilogy, hold, clf

pause

Put the handheld in low power mode.

Syntax

pause(t)

Description

pause(t) makes the handheld wait for t seconds in low-power mode.

plot

Generic plot.

Syntax

plot(y)
plot(x, y)
plot(x, y, style)

Description

Command plot displays graphical data. The data are given as two vectors of coordinates x and y. Depending on the style>, the points are displayed as individual marks (style = 'x' or 'o') or are linked with lines (style = '-'). The style may also specify the color:

ColorCharacter
blackk
blueb
greeng
cyanc
redr
magentam
yellowy
whitew

If x and y are matrices, each row is considered as a separate line or set of marks; if only one of them is a matrix, the other one, a vector, is reused for each line. The style string may contain several styles which are used for each line, and recycled if necessary.

The first argument x may be omitted; its default value is 1:size(y,2).

Example

Plot a sine in black and a cosine in light blue:

t = 0:0.1:2*pi;
plot(t,[sin(t); cos(t)], 'kc');

See also

semilogx, semilogy, loglog, polar, hold, clf

polar

Polar plot.

Syntax

polar(phi, r)
polar(phi, r, style)

Description

Command polar displays graphical data in polar coordinates. The data are given as two vectors of polar coordinates phi and r; their corresponding cartesian coordinates are x=r*cos(phi) and y=r*sin(phi). Several polar plots may be combined with hold; however, other kinds of plots should not be mixed.

See the description of plot for more information about the third argument.

Example

phi = 2*pi*(0:100)/100;
plot(phi, 2+cos(5*phi), 'r');

See also

plot, hold, clf

semilogx

Generic plot with a logarithmic scale along x axis.

Syntax

semilogx(y)
semilogx(x, y)
semilogx(x, y, style)

Description

Command semilogx is similar to plot, except that the scale along the x axis is logarithmic.

See also

plot, semilogy, loglog, hold, clf

semilogy

Generic plot with a logarithmic scale along y axis.

Syntax

semilogy(y)
semilogy(x, y)
semilogy(x, y, style)

Description

Command semilogy is similar to plot, except that the scale along the y axis is logarithmic.

See also

plot, semilogx, loglog, hold, clf


Copyright 1998-2001, Calerga.

All rights reserved.