| LTPDA Toolbox | contents | ![]() |
You can build AOs from existing ASCII data files. Various formats are supported, for example, multiple columns, files containing comments.
The data-pack for this training session should be downloaded from the LTPDA web-site. The zip file will expand to a top-level directory. This should contain sub-directories for each topic of the training session.
The rest of the tutorial will assume that you have changed directories in MATLAB to the data-pack directory so that filenames are relative to that directory. To change the working directory of MATLAB, either use the MATLAB interface or type
cd /path/to/my/data/pack
The data-pack contains a simple two-column text file which represents a time-series sampled at 10Hz. The first column contains the time-stamps, the second column the amplitude values.
To convert this data file to an AO, use the following command:
>> a = ao('topic1/simpleASCII.txt')
M: running ao/ao
M: load file: simpleASCII.txt
M: constructing from filename and/or plist
M: running ao/ao
M: constructing from data object tsdata
M: running ao/ao
M: running ao/display
----------- ao 01: topic1/simpleASCII.txt_01_02 -----------
name: topic1/simpleASCII.txt_01_02
data: (0,1.13549060238654) (0.1,2.37202031808076) (0.2,-0.531181753855465) (0.3,1.25684477541224) (0.4,1.30895517480354) ...
-------- tsdata 01 ------------
fs: 10
x: [1000 1], double
y: [1000 1], double
dx: [0 0], double
dy: [0 0], double
xunits: [s]
yunits: []
nsecs: 100
t0: 1970-01-01 00:00:00.000
-------------------------------
hist: ao / ao / SId: fromDatafile.m,v 1.21 2009/08/05 10:35:55 hewitson Exp S-->SId: ao.m,v 1.284 2009/08/25 15:01:16 mauro Exp S
mdlfile: empty
description:
UUID: de31042b-cded-4542-999b-cf010b702355
-----------------------------------------------------------From the output on the screen you can see that
You can plot this data and see that it is just a randon noise time-series.
The data-pack contains a data file which contains multiple columns of data. Here we will load only selected columns from the file and produce multiple AOs, one for each column loaded. Column 1 of the file contains the time-stamps; columns 2-6 contain sine waves at frequencies 1-5Hz.
Let's load the 2Hz and 4Hz sine waves from the file. At the same time, we'll give the AOs names, Y units, and descriptions.
sigs = ao(plist('filename', 'topic1/multicolumnASCII.txt', ...
'columns', [1 3 1 5], ...
'name', {'sin2', 'sin4'}, ...
'yunits', {'m', 'm'}, ...
'description', {'sine wave at 2Hz', 'sine wave at 4Hz'}))
You can plot the results and focus on the first 2 seconds of data
sigs.iplot(plist('XRanges', [0 2]))
|
Saving and loading AOs | Writing LTPDA scripts | ![]() |
©LTP Team