Accelerometer data MatLab GUI
1 view (last 30 days)
Hello i'm trying to read in raw data from an accelerometer thru my matlab GUI. I have a pushbutton for serial read, calibration, and port closing that all work fine but i'm trying to create a button that will read in raw data from the accelerometer port.
% START DATA - PUSHBUTTON6
function pushbutton6_Callback(hObject, eventdata, handles)
function [gx gy gz] = readAcc(out,calCo)
%mapping between analog inputs and X,Y,Z axes.
% Xch = 1;
% Ych = 3;
% Zch = 2;
%read voltages from accelerometer and reorder
%determine what offset and gain values to use
offset = calCo.offset;
gain = calCo.g;
accel = (reordered - offset) ./ gain;
%map analog inputs to axes
gx = accel(1);
gy = accel(2);
gz = accel(3);
The error i'm getting is
Error: File: BW2.m Line: 161 Column: 1 The function "readAcc" was closed with an 'end', but at least one other function definition was not. To avoid confusion when using nested functions, it is illegal to use both conventions in the same file.
even if I delete the bottom 'end' function, I press the pushbutton and nothing reads out.