How to compare parts of an Array

1 vue (au cours des 30 derniers jours)
Vitali Walter
Vitali Walter le 6 Juin 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?

Réponses (0)

Catégories

En savoir plus sur Just for fun dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by