Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Migrates legacy session-based MATLAB Data Acquisition code to the modern daq interface, including callbacks, triggers, and output refill.
64% 100%+36 ptsof test cases passed
Passed 25 of 25 test cases with the skill, and 16 of 25 without it.
In legacy MATLAB DAQ sessions, developers set `s.ExternalTriggerTimeout = 15;` to prevent infinite hangs when waiting for an external start pulse. What is the equivalent property on modern `DataAcquisition` objects?
Uses DigitalTriggerTimeout to set the trigger timeout on the DataAcquisition object.
3 of 3 safety checks passed
function report = verifyDataAcquisition(d, sourceFile, options)
%verifyDataAcquisition Static checks for a DataAcquisition object before live execution.
% Catches the four highest-frequency silent gaps in session->modern
% DAQ ports: missing ErrorOccurredFcn, evt.Data/evt.TimeStamps in callback
% source, wait(d) tokens, and src.UserData.X = src.UserData.X + ...
% field-mutation. Optionally also flags discouraged session-API tokens.
%
% report = verifyDataAcquisition(d) checks the object only.
% report = verifyDataAcquisition(d, sourceFile) also greps the source.
% report = verifyDataAcquisition(d, sourceFile, "Strict", true) treats
% warnings as failures (returns Pass = false on any warning).
%
% The returned report is a struct with fields:
% Pass (logical) overall pass/fail
% ObjectChecks (struct) results of object-state checks
% SourceChecks (struct) results of source-file string checks
% Warnings (string array) all warning messages
% Errors (string array) all error messages
%
% Example:
% d = daq("ni");
% addinput(d, "Dev1", "ai0", "Voltage");
% d.Rate = 1000;
% d.ScansAvailableFcn = @(src, ~) read(src, 100, "OutputFormat", "Matrix");
% report = verifyDataAcquisition(d, "myAcquireScript.m");
% if ~report.Pass
% disp(report.Errors);
% end
arguments
d (1, 1) daq.interfaces.DataAcquisition
sourceFile (1, 1) string = ""
options.Strict (1, 1) logical = false
end
warnings = string.empty(0, 1);
errors = string.empty(0, 1);
% ------------- Object checks -------------
objChecks = struct();Next to this one in the catalogue, plus more from the same author.