Looping data acqusition process for 100 cycles
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
The following is a code to acquire data from a tri-axial acclerometer and log the data into excel file. I need help in looping this code for 100 Cycles.
daq.getDevices
daqSession = daq.createSession('ni')
daqSession.addAnalogInputChannel('Dev1', 'ai0', 'Accelerometer');
daqSession.addAnalogInputChannel('Dev1', 'ai1', 'Accelerometer');
daqSession.addAnalogInputChannel('Dev1', 'ai2', 'Accelerometer');
daqSession.Rate = 2048;
daqSession.DurationInSeconds = 5;
daqSession.Channels(1).Sensitivity = 0.010;
daqSession.Channels(2).Sensitivity = 0.010;
daqSession.Channels(3).Sensitivity = 0.010;
[data,time] =daqSession.startForeground();
A=[data, time];
filename ='Condition-1.xlsx';
xlswrite(filename,A)
daqSession.release();
delete(daqSession);
clear daqSession;
x=data(:,1);y=data(:,2);z=data(:,3);
figure
plot(time,x,time,y,time,z)
title('Time domain signal')
xlabel('t (seconds)')
ylabel('X(t)')
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu National Instruments Frame Grabbers finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!