How to compare parts of an Array
3 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!