0

我创建了一个 MATLAB 应用程序,当用户单击“开始”按钮时,它从 MCC USB-1608FS-Plus 系列 DAQ 设备读取模拟数据。运行此应用程序会导致以下错误:

Warning: DAQSDK Warning: Ignored call to method 'stop' in state 'ReadyState'. 
Error using test/StartButtonPushed (line 54)
Timeout expired before operation could complete.

请问有没有人知道解决方案?这是我的代码,我在导致错误的行上方评论:

properties (Access = public)
        analogData;
        analogDevice;
        startTime;
        stopButtonPressed = false;
        times = zeros(1, 720*120);
end

function StartButtonPushed(app, event)
            app.stopButtonPressed = false;
            
            app.analogDevice = daq("mcc");
            addinput( app.analogDevice, "Board0", "Ai0", "Voltage" );
            app.analogDevice.Rate = app.RatescanssEditField.Value;
            app.analogDevice.UserData = struct("Data",[],"Count",1);
            
            % THIS LINE CAUSES AN ERROR
            app.analogData = read(app.analogDevice, seconds( app.DurationSpinner.Value ) );
            
            t0 = clock;
            app.startTime = datetime;

            while(etime(clock,t0) < app.DurationSpinner.Value) && (app.stopButtonPressed == false)
                app.times(1) = etime(clock, t0);
            end
            
            app.SavetoFileButton.Enable = true;
        end
4

0 回答 0