Live Data Acquisition App with 2 Channels?

조회 수: 4 (최근 30일)
Adrienne Blevins
Adrienne Blevins 2019년 8월 21일
댓글: Edgardo AC Abreu 2022년 8월 21일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Data Acquisition Toolbox Supported Hardware에 대해 자세히 알아보기

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by