Live Data Acquisition App with 2 Channels?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
How can I modify the Live Data Acquisition App Example to display and save data from 2 channels instead of only 1? The GUI in the example is perfect for my system, and I would just like to be able to add on one more channel.
1 commentaire
Edgardo AC Abreu
le 8 Août 2022
Hi Adrienne,
Do you have any update about you qustion.
Im trying to do the same.
best regard
Réponses (1)
Ganesh Regoti
le 13 Jan 2020
Hi,
I understand that you need two input channels for the Live Data Acquisition app. To achieve that you can do the following
- You can edit the mlapp file using the following command.
edit LiveDataAcquisition.mlapp
2. Open the design view and add respective dropdown for Channel-2 from component library. (drag and drop)
3 .In codeview, the DAQSession is created in the function updateChannelMeasurementComponents. You can add another input channel to the same session. You can refer this link
After you make appropriate changes in the code. The app must take in data from two input channels.
Hope this helps!
7 commentaires
terry Gorman
le 11 Mai 2022
Did anyone actually get this working?
If so could you send me what code you modified.
Thanks
Edgardo AC Abreu
le 21 Août 2022
Veit try this % Create a new data acquisition object
d = daq(vendor);
addinput(d, deviceID, app.ChannelDropDown.Value, measurementType);
addinput(d, deviceID, "ai1", measurementType);
...
% Get subsystem information to update channel dropdown list and channel property options
% For devices that have an analog input or an audio input subsystem, this is the first subsystem
subsystem = app.DevicesInfo(deviceIndex).Subsystems(1);
app.ChannelDropDown.Items = cellstr(string(subsystem.ChannelNames));
app.Channel2DropDown.Items = cellstr(string(subsystem.ChannelNames));
Norio try this
% Store continuous acquisition data in FIFO data buffers
buffersize = round(app.DAQ.Rate * app.TimewindowEditField.Value) + 1;
app.TimestampsFIFOBuffer = storeDataInFIFO(app, app.TimestampsFIFOBuffer, buffersize, timestamps);
app.DataFIFOBuffer = storeDataInFIFO(app, app.DataFIFOBuffer, buffersize, data(:,1));%%%isso fez coletar o canal ai0
app.Data2FIFOBuffer = storeDataInFIFO(app, app.Data2FIFOBuffer, buffersize, data(:,2));%%%isso fez coletar o canal ai1
% Update plot data grafico direita ai0
set(app.LivePlotLine, 'XData', app.TimestampsFIFOBuffer, 'YData', app.DataFIFOBuffer);
if numel(app.TimestampsFIFOBuffer) > 1
xlim(app.LiveAxes, [app.TimestampsFIFOBuffer(1), app.TimestampsFIFOBuffer(end)])
end
% Update plot data grafico esquerda ai1
set(app.LivePlotLine2, 'XData', app.TimestampsFIFOBuffer, 'YData', app.Data2FIFOBuffer);
if numel(app.TimestampsFIFOBuffer) > 1
xlim(app.Live2Axes, [app.TimestampsFIFOBuffer(1), app.TimestampsFIFOBuffer(end)])
end
end
Terry, yes i did.
but at the moment Im not able to save bouth channel. I need same help to do this
Voir également
Catégories
En savoir plus sur National Instruments Frame Grabbers dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!