MatLab GUI accelerometer reading DATA
古いコメントを表示
Hello, as of right now i'm trying to read in accelerometer data to my MatLab gui thru a pushbutton.. So far here is my code
function pushbutton6_Callback(hObject, eventdata, handles)
%mapping between analog inputs and X,Y,Z axes.
% Xch = 1;
% Ych = 3;
% Zch = 2;
fprintf(out.s,'R');
%read voltages from accelerometer and reorder
reordered(1)= fscanf(out.s,'%u');
reordered(2)= fscanf(out.s,'%u');
reordered(3)= fscanf(out.s,'%u');
%determine what offset and gain values to use
offset = calCo.offset;
gain = calCo.g;
accel = (reordered - offset) ./ gain;
%map analog inputs to axes
handles.gx = accel(1);
handles.gy = accel(2);
handles.gz = accel(3);
guidata(hObject, handles)
This code was partially written for me. I'm trying to understand it since i've only been using matlab for 3 weeks. Can anybody help me what i'm doing wrong? I have a button for calibrating and a button for reading in the serial, but as of right now i'm trying to read actual data and later graph.
THANKS
FIrst problem fixed... scroll down below for the new problem I cannot seem to fix.. THANKS
8 件のコメント
Amed
2013 年 2 月 8 日
Walter Roberson
2013 年 2 月 8 日
You have not indicates the problem you are encountering.
Amed
2013 年 2 月 8 日
Walter Roberson
2013 年 2 月 8 日
Have you tried putting in a breakpoint at the first executable line of code, and running, and single-stepping to see what happens?
Your code does not display any values or change any gui elements, so it might not be obvious that it is running.
Amed
2013 年 2 月 8 日
Amed
2013 年 2 月 8 日
Amed
2013 年 2 月 8 日
Walter Roberson
2013 年 2 月 8 日
Note: the lines
guidata(hObject, handles);
handles.gx= 0;
handles.gy= 0;
should have the assignments before the guidata() call.
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Update figure-Based Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!