Data loading on MATLAB - GiulioRomualdi/DecaWaveEVB1000Experiments GitHub Wiki
In order to load data in MATLAB this set of scripts
for MATLAB is required.
In the following it is assumed that the scripts have been downloaded and extracted in a directory $SCRIPTS_HOME
.
To start loading data change directory to $SCRIPTS_HOME
within MATLAB and run
init
-
Prepare a directory
$AUTORNG_PATH
with files of the forma2a_anch_i.csv
collected during the autoranging procedure; -
Change directory to
$AUTORNG_PATH
within MATLAB; -
Create an empty struct named
autoranging
autoranging = struct();
An existing struct
autoranging
may be used if already created when loading other types of autoranging data
- Load the data
autoranging = load_data_anch_autoranging('a2a_anch_', autoranging);
The autoranging
struct will contain the following fields (in addition to the fields already contained in the struct)
-
rij
: range between the anchor i and the anchor j-
ai
: measures collected during the autoranging procedure evaluated by the anchor Ai; -
aj
: measures collected during the autoranging procedure evaluated by the anchor Aj; -
joined
: all the measures collected during the autoranging procedure, i.e.ai
Uaj
.
-
In order to compare the autoranging data with the manual measurements it is required to add
the manual measurements to the autoranging
struct previously filled with some autoranging data.
- Prepare a matlab function file
laser_data.m
function [autoranging, plane_height] = laser_data(autoranging)
plane_height = <plane_height>;
autoranging.('r01').('laser') = <r01>;
autoranging.('r02').('laser') = <r02>;
autoranging.('r03').('laser') = <r03>;
autoranging.('r12').('laser') = <r12>;
autoranging.('r13').('laser') = <r13>;
autoranging.('r23').('laser') = <r23>;
end
where
-
<plane_height>
is the height of the common plane where the anchors A0, A1 and A2 are placed; -
<rij>
are the measured ranges.
- Run
[autoranging, plane_height] = laser_data(autoranging)
The autoranging
struct will contain the following fields (in addition to the fields already contained in the struct)
-
rij
: range between the anchor i and the anchor j-
laser
: measures collected using a laser distance measurer
-
How to load the ranges between the tag and all the anchors collected during a trilateration experiment
-
Prepare a directory
$TAG_RNG_PATH
with a file of the formtag_<device_ID>_DD_MM_YYYY_trr.csv
collected during a trilateration experiment; -
Change directory to
$TAG_RNG_PATH
within MATLAB; -
To load the ranges run
path = load_data_path_ranges(<path_filename>);
where <path_filename>
is the filename
The struct path
will contain the following fields
-
r0
: range between the tag and the anchor 0; -
r1
: range between the tag and the anchor 1; -
r2
: range between the tag and the anchor 2; -
r3
: range between the tag and the anchor 3.
-
Prepare a directory
$ANCH_POS_PATH
with a file of the formtag_<device_ID>_DD_MM_YYYY_apr.csv
collected during a trilateration experiment; -
Change directory to
$ANCH_POS_PATH
within MATLAB; -
To load the position of the anchors run
anchor_cartesian = load_anchor_position()
anchor_cartesian
is 3 x 4 matrix containing the cartesian position of the four anchors.
- Prepare a directory
$TRILAT_PATH
with files of the formtag_<device_ID>_DD_MM_YYYY_tpr.csv
collected during a trilateration experiment;
Only one file per tag ID can be present in
$TRILAT_PATH
- To load the trilateration data of all the tags run
trilateration = load_data_paths_trilateration()
The trilateration
struct will contain the following fields
-
tag_i
: where i is the tag id, counting from 0-
x
: the x coordinate; -
y
: the y coordinate; -
z
: the z coordinate.
-