Live Data Acquisition App with 2 Channels?

3 次查看(过去 30 天)
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 个评论
Edgardo AC Abreu
Edgardo AC Abreu 2022-8-8
Hi Adrienne,
Do you have any update about you qustion.
Im trying to do the same.
best regard

请先登录,再进行评论。

回答(1 个)

Ganesh Regoti
Ganesh Regoti 2020-1-13
Hi,
I understand that you need two input channels for the Live Data Acquisition app. To achieve that you can do the following
  1. 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 个评论
terry Gorman
terry Gorman 2022-5-11
Did anyone actually get this working?
If so could you send me what code you modified.
Thanks
Edgardo AC Abreu
Edgardo AC Abreu 2022-8-21
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

请先登录,再进行评论。

产品


版本

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by