collecting Live data from a simulated NI-6001 which has 8 channels. I have got to the point where I can display multiple plots on the liveaxes but, It is only showing the calibrated signal on the plots when I only use one of the slopes & intercepts. As soon as I try to use multiple slopes and intercepts it no longer works.
Code for calibration of the multiple channels. The main body of code that I think is where the problem is is here
%if the calibration switch is turned on use the slopes and
% intercepts read in above
if app.calibrate == true
%app.indices is a private property that tracks the selected channels in the UI of the app
while i < numel(app.indices)
i = i + 1;
data(:,i) = data(:,i)*slope(:,i)+intercepts(:,i);
end
% if the calibration switch is turned off then just display data as Voltage
elseif app.calibrate == false
data = data*1 + 0;
end
Code used for data displayed on the graph
buffersize = round(app.DAQ.Rate * app.TimewindowEditField.Value) + 1;
app.TimestampsFIFOBuffer = storeDataInFIFO(app, app.TimestampsFIFOBuffer, buffersize, timestamps);
app.DataFIFOBufferch1 = storeDataInFIFO(app, app.DataFIFOBufferch1, buffersize, data(:,app.indices));
plot(app.LiveAxes, app.TimestampsFIFOBuffer, app.DataFIFOBufferch1)
I read in the slopes and intercepts calculated in the workspace and read it in using evalin.
When the calibrate switch is in noting appears on the graph vs when it is off
[uncalibrateddata][1]
[calibrateddata2