How to compare parts of an Array

3 views (last 30 days)
Vitali Walter
Vitali Walter on 6 Jun 2017
Hallo. I am new in programming and try to learn it. I wrote a Programm for analyzing an Hallsensor with an myDAQ. That is the Code:
s = daq.createSession('ni');
addAnalogInputChannel(s,'myDAQ1', 0, 'Voltage');
addAnalogInputChannel(s,'myDAQ1', 1, 'Voltage');
s.Rate = 1000; % Scans pro Sekunde
s.IsContinuous = true; lh = addlistener(s,'DataAvailable',@plotData);
startBackground(s);
s.wait();
end
and the function plotData:
function plotData(src, event)
a = false;
if ~a
A = event.Data;
a = true;
end
%erster Array wird abgespeichert
disp(event.Data)
plot(event.TimeStamps, event.Data);
end
I wants to Programm an Jostick, which is usuing an hallsensor. With the Code and myDAQ I can Display the valtage Graphs for x and y axis. I wntas now to create a function that would Display the Position of the joistick as a dot but dont how to realize it. I thought of to save the first value and compare it with the other values during the session. Not sure how it to do.
Can somebody help me pls?

Answers (0)

Categories

Find more on Tables in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!