-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadCalibration.m
More file actions
34 lines (27 loc) · 883 Bytes
/
readCalibration.m
File metadata and controls
34 lines (27 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
%% Phidget calibration filereader
% Jon Renslo
% 8-1-2013
% Reads files outputted by PhidgetLoadCellDataRecorder.py
function out = readCalibration(filename)
% readCalibration Reads csv files outputted by Phidget_calibrator.py
% out = Phidget_filereader(filename)
% out is a struct with data from a bridge.
% out.serialNum
% out.rate
% out.gain
% out.data the raw array of data in the format
% [serial num, index, calibration constant (kg/analog reading)]
% file should be in the same directory, or filename can be a path
%% File reading and parsing
fdata = csvread(filename);
%first row holds metadata
% [rate, gain, points recorded]
rate = fdata(1,1);
gain = fdata(1,2);
fdata = fdata(2:end,:);
temp.rate = rate;
temp.gain = gain;
temp.data = fdata;
temp.getConst = @(serial,index) fdata(fdata(:,1)==serial&fdata(:,2)==index,3);
out = temp;
end