Live Data Acquisition App with 2 Channels?

3 ビュー (過去 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

サインインしてコメントする。

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by