Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
DAQ session problem (Matlab R2011b 64-bit)

Subject: DAQ session problem (Matlab R2011b 64-bit)

From: Patrick

Date: 9 May, 2012 00:58:07

Message: 1 of 5

The following commands under Matlab:

>> daqObj = daq.createSession('ni')
>> daqObj.addAnalogOutputChannel('Dev1', 0, 'Voltage')
>> outFcn = zeros(1000, 1);
>> daqObj.Rate = 1e5
>> daqObj.queueOutputData(outFcn);
>> daqObj.startForeground();

Results in the following

Warning: Error occurred while executing callback:
Error using min
Invalid number of input arguments
> In Channel>Channel.onCustomEvent at 345
  In Channel>@(source,event)obj.onCustomEvent(event.Type,event.Data) at 273
  In Session>Session.doWait at 1928
  In Session>Session.doStartForeground at 1817
  In StateReadyToStart>StateReadyToStart.startForeground at 85
  In Session>Session.startForeground at 466
Warning: Error occurred while executing callback:
Error using min
Invalid number of input arguments
> In Channel>Channel.onCustomEvent at 345
  In Channel>@(source,event)obj.onCustomEvent(event.Type,event.Data) at 273
  In Session>Session.doWait at 1929
  In Session>Session.doStartForeground at 1817
  In StateReadyToStart>StateReadyToStart.startForeground at 85
  In Session>Session.startForeground at 466


The device is an NI-6259. We also have two NI-6363 in the same system (three devices total). I also get this same error with a different machine with only 1 NI-6251 in the system.

I don't remember having a problem this severe before, but that was on a different computer.

Subject: DAQ session problem (Matlab R2011b 64-bit)

From: Sam

Date: 9 Oct, 2013 01:02:06

Message: 2 of 5


Hi Patrick,
Did you manage to find a solution to the error you were getting. I am getting the same error with MATLAB 2013.

Regards
Sam

"Patrick " <praphael@gmail.com> wrote in message <jocfev$98$1@newscl01ah.mathworks.com>...
> The following commands under Matlab:
>
> >> daqObj = daq.createSession('ni')
> >> daqObj.addAnalogOutputChannel('Dev1', 0, 'Voltage')
> >> outFcn = zeros(1000, 1);
> >> daqObj.Rate = 1e5
> >> daqObj.queueOutputData(outFcn);
> >> daqObj.startForeground();
>
> Results in the following
>
> Warning: Error occurred while executing callback:
> Error using min
> Invalid number of input arguments
> > In Channel>Channel.onCustomEvent at 345
> In Channel>@(source,event)obj.onCustomEvent(event.Type,event.Data) at 273
> In Session>Session.doWait at 1928
> In Session>Session.doStartForeground at 1817
> In StateReadyToStart>StateReadyToStart.startForeground at 85
> In Session>Session.startForeground at 466
> Warning: Error occurred while executing callback:
> Error using min
> Invalid number of input arguments
> > In Channel>Channel.onCustomEvent at 345
> In Channel>@(source,event)obj.onCustomEvent(event.Type,event.Data) at 273
> In Session>Session.doWait at 1929
> In Session>Session.doStartForeground at 1817
> In StateReadyToStart>StateReadyToStart.startForeground at 85
> In Session>Session.startForeground at 466
>
>
> The device is an NI-6259. We also have two NI-6363 in the same system (three devices total). I also get this same error with a different machine with only 1 NI-6251 in the system.
>
> I don't remember having a problem this severe before, but that was on a different computer.

Subject: DAQ session problem (Matlab R2011b 64-bit)

From: Sam

Date: 9 Oct, 2013 01:03:06

Message: 3 of 5

"Patrick " <praphael@gmail.com> wrote in message <jocfev$98$1@newscl01ah.mathworks.com>...
> The following commands under Matlab:
>
> >> daqObj = daq.createSession('ni')
> >> daqObj.addAnalogOutputChannel('Dev1', 0, 'Voltage')
> >> outFcn = zeros(1000, 1);
> >> daqObj.Rate = 1e5
> >> daqObj.queueOutputData(outFcn);
> >> daqObj.startForeground();
>
> Results in the following
>
> Warning: Error occurred while executing callback:
> Error using min
> Invalid number of input arguments
> > In Channel>Channel.onCustomEvent at 345
> In Channel>@(source,event)obj.onCustomEvent(event.Type,event.Data) at 273
> In Session>Session.doWait at 1928
> In Session>Session.doStartForeground at 1817
> In StateReadyToStart>StateReadyToStart.startForeground at 85
> In Session>Session.startForeground at 466
> Warning: Error occurred while executing callback:
> Error using min
> Invalid number of input arguments
> > In Channel>Channel.onCustomEvent at 345
> In Channel>@(source,event)obj.onCustomEvent(event.Type,event.Data) at 273
> In Session>Session.doWait at 1929
> In Session>Session.doStartForeground at 1817
> In StateReadyToStart>StateReadyToStart.startForeground at 85
> In Session>Session.startForeground at 466
>
>
> The device is an NI-6259. We also have two NI-6363 in the same system (three devices total). I also get this same error with a different machine with only 1 NI-6251 in the system.
>
> I don't remember having a problem this severe before, but that was on a different computer.

Subject: DAQ session problem (Matlab R2011b 64-bit)

From: Sunkyue Kim

Date: 17 Jun, 2014 13:30:13

Message: 4 of 5

I found the reason.

Somewhere in daq.Session.m, it tries to use min function with the arguments of uint64 type, however, min between uint64 is not defined at least before R2013a (the version that i'm using)

To be specific, in /toolbox/daq/daq/+daq/Session.m, around 3600s line, there's three lines

                    obj.NotifyWhenDataAvailableExceeds = min(...
                        obj.NotifyWhenDataAvailableExceeds,...
                        obj.NumberOfScans);

which calls min with uint64 arguments. So that's the cause of error. It was quite hard to find since min function is precompiled and I cannot debug into it.

Anyway, I temporarilty commented out that three lines assuming scanning rate do not exceed the limit.

However one should implement uint64 compatible min function and override original min function to avoid all errors.


"Patrick " <praphael@gmail.com> wrote in message <jocfev$98$1@newscl01ah.mathworks.com>...
> The following commands under Matlab:
>
> >> daqObj = daq.createSession('ni')
> >> daqObj.addAnalogOutputChannel('Dev1', 0, 'Voltage')
> >> outFcn = zeros(1000, 1);
> >> daqObj.Rate = 1e5
> >> daqObj.queueOutputData(outFcn);
> >> daqObj.startForeground();
>
> Results in the following
>
> Warning: Error occurred while executing callback:
> Error using min
> Invalid number of input arguments
> > In Channel>Channel.onCustomEvent at 345
> In Channel>@(source,event)obj.onCustomEvent(event.Type,event.Data) at 273
> In Session>Session.doWait at 1928
> In Session>Session.doStartForeground at 1817
> In StateReadyToStart>StateReadyToStart.startForeground at 85
> In Session>Session.startForeground at 466
> Warning: Error occurred while executing callback:
> Error using min
> Invalid number of input arguments
> > In Channel>Channel.onCustomEvent at 345
> In Channel>@(source,event)obj.onCustomEvent(event.Type,event.Data) at 273
> In Session>Session.doWait at 1929
> In Session>Session.doStartForeground at 1817
> In StateReadyToStart>StateReadyToStart.startForeground at 85
> In Session>Session.startForeground at 466
>
>
> The device is an NI-6259. We also have two NI-6363 in the same system (three devices total). I also get this same error with a different machine with only 1 NI-6251 in the system.
>
> I don't remember having a problem this severe before, but that was on a different computer.

Subject: DAQ session problem (Matlab R2011b 64-bit)

From: Steven Lord

Date: 17 Jun, 2014 13:50:32

Message: 5 of 5


"Sunkyue Kim" <mathworks.22@kimsunk.net> wrote in message
news:lnpft5$2ka$1@newscl01ah.mathworks.com...
> I found the reason.
>
> Somewhere in daq.Session.m, it tries to use min function with the
> arguments of uint64 type, however, min between uint64 is not defined at
> least before R2013a (the version that i'm using)

Yes it is.

>> version
ans =
8.1.0.604 (R2013a)
>> min(uint64(1), 2)
ans =
                    1

It's been supported since at least release R2010b. See the first item in the
Mathematics section of the Release Notes for that release.

http://www.mathworks.com/help/matlab/release-notes-older.html#R2010b

>> version
ans =
7.11.0.584 (R2010b)
>> min(uint64(1), 2)
ans =
                    1

> To be specific, in /toolbox/daq/daq/+daq/Session.m, around 3600s line,
> there's three lines
>
> obj.NotifyWhenDataAvailableExceeds = min(...
> obj.NotifyWhenDataAvailableExceeds,...
> obj.NumberOfScans);
>
> which calls min with uint64 arguments. So that's the cause of error. It
> was quite hard to find since min function is precompiled and I cannot
> debug into it.
>
> Anyway, I temporarilty commented out that three lines assuming scanning
> rate do not exceed the limit.

I strongly recommend you NOT modify toolbox code. Doing so may cause
problems later on, where toolbox code that assumes that these lines have
executed (and so the NotifyWhenDataAvailableExceeds property is no greater
than the NumberOfScans property) does something involving one or both of
those properties.

> However one should implement uint64 compatible min function and override
> original min function to avoid all errors.
>
> "Patrick " <praphael@gmail.com> wrote in message
> <jocfev$98$1@newscl01ah.mathworks.com>...
>> The following commands under Matlab:
>>
>> >> daqObj = daq.createSession('ni')
>> >> daqObj.addAnalogOutputChannel('Dev1', 0, 'Voltage')
>> >> outFcn = zeros(1000, 1);
>> >> daqObj.Rate = 1e5
>> >> daqObj.queueOutputData(outFcn);
>> >> daqObj.startForeground();
>>
>> Results in the following Warning: Error occurred while executing
>> callback:
>> Error using min
>> Invalid number of input arguments

That's a different error than the one you described; that makes me suspect
that you've defined your own MIN function that accepts a different number of
input arguments than the one included in MATLAB. Execute this command, and
if you see an instance of min.m outside a MathWorks product listed then
rename or remove it and try executing these steps again.

    which -all min

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us