Custom operations: Navigating the command board of a|e

This tutorial illustrates how the command board in a|e is used (located in the lower right corner of the GUI).

Basic functionality

The command board is a portal to all of MATLAB's functions from within the a|e GUI: It acts the same as the traditional MATLAB command window.

Try e.g. typing 2*2. This returns the answer: ans = 4

a|e's data structure

NOTE: From version 1.2 and onward, replace the following guide with "Abs" and "Em" instead of "abs" and "em".

Now try typing 'abs' instead:

This provides direct insight into the data structure of a|e. 'abs' is a MATLAB structure containing information about the loaded absorption spectra. In this example two absorption spectra are loaded which is defined by an 1x2 structure containing the fields:

.name      (name displayed in the data listbox and graph legend)
.data       (edited spectral data plotted in the graph window)
.rawdata  (the raw spectral data loaded from the original file)
.color       (color of the spectrum when plotted)

Typing e.g. 'abs(1).name' returns the name of the first spectrum:

while 'abs(2).data' returns the data of the second spectrum:

etc.. In the data field, the left column is wavelengths while the right column is the absorption values.

Creating a new data set

A new data set can be made for instance by duplicating one of the existing data sets. In the command window type: 

abs(3) = abs(2)

This will expand the 1x2 abs data structure to a 1x3 structure in which the third element is a duplicate of the second. This new duplicate is automatically added to the absorption spectra data listbox:

We can set the name of this new spectrum to 'Demonstration' using: 

abs(3).name = 'Demonstration'

Operate on loaded data

We will now try to perform a simple operation on the newly duplicated spectrum, a wavelength shift:

abs(3).data(:,1) = abs(3).data(:,1) + 150

This tells that the 1st data column of absorption spectrum 3 (the wavelengths) is equal to the same column + 150 nm. The result is a shift in the absorption spectrum:


And after.

We can equally easy multiply this spectrum by a constant (here 3):

abs(3).data(:,2) = abs(3).data(:,2) * 3

The emission spectra data structure

The emission spectra are defined in a data structure completely analogously to the absorption spectra, but called 'em' instead of 'abs':

Other handles

Some perhaps convenient handles in the GUI are the two axes handles:

 handles.AbsWindow :   The absorption plot window
 handles.EmWindow  :   The emission plot window

Typing e.g.:

ylabel(handles.AbsWindow,'Extinction coefficient')

Sets the y-axis label in the absorption window to "Extinction coefficient":

The absorption baselines and emission background spectra are stored in structures called:

baseA  :   Absorption baselines
baseE  :   Emission background spectra

They contain the same fields as the 'abs' and 'em' data structures: