MATLAB Answers

Robert
0

NI-USB 6008 Matlab Mac OSX

Asked by Robert
on 25 Mar 2013
Dear Matlab-Experts,
Following Neel Kulkarni's suggestion, I shift my question, initially posted to the NI-forum ( http://forums.ni.com/t5/Academic-Hardware-Products-NI/NI-USB-6008-Matlab-Mac-OSX/m-p/2363548), to MATLAB Central.
Being a non-too-skilled computer user, I've been unsuccessfully trying to address an NI USB-6008 A/D converter from within MATLAB R2012b on a Mac OS 10.8.3 for quite a while.
Searching through the internet ( http://www.binghamsite.com/miscellaneous/matlab-mex-and-ni-usb), I learned that the general way to go is to use the mex command from within MATLAB to compile code written in C into programs understood by MATLAB. Following the instructions provided on that website, I ran mex -setup, edited the mexopts.sh file and succeeded in compiling the simple timestwo.c file for test purposes.
I then tried to do the same to the example data acquisition .c-files provided with the NI-DAQmx Base (v 3.6) driver package. I was informed that mex objects require the inclusion of the NI-DAQmx Base header (NIDAQmxBase.h), so I tried to run
mex -I"/Applications/National Instruments/NI-DAQmx Base/includes" acquire1scan.c
The compilation fails producing a bunch of information I don't understand. However, the error messages
"Error: This platform is unsupported because long is not 4 bytes." or
"Error: This platform is unsupported because int is not the same size as long."
show up repeatedly. My Macbook uses an Intel Core i5 processor which is 64-bit, if that can have anything to do with it.
Any suggestions on how to get this running would be highly appreciated.
Thanks,
Robert
p.s.: Neel: Thanks for getting back to me. I'm fully aware that the Data Acquisition Toolbox, which Windows users may benefit from, would make my life much easier. But I think that I was reasonably specific about the system I'm working on and the problem I'm trying to solve. To simply suggest to go and use something entirely different is not particularly helpful.

  0 Comments

Sign in to comment.

2 Answers

Answer by Walter Roberson
on 25 Mar 2013

Notice this from the binghamsite web page:
Finally, your version of Matlab must be 32-bit as the NI-DAQ Base drivers are compiled with 32-bit extensions. If you have a 64-bit version you may be able to switch it to run in 32-bit mode. You can do this by right-clicking on the Matlab application and selecting "Get Info" in the pop-up menu. You should have an option to "Open in 32 bit mode". Now when you open Matlab it should run as "maci".
Unfortunately, MATLAB R2012b on OS-X is 64 bit only, so it cannot be switched into 32 bit mode.
You would probably need to edit the source by careful examination of the functionality. The source should not be assuming that sizeof(int) == sizeof(long), but since it is, fixing it might be a mess.

  0 Comments

Sign in to comment.


Answer by Robert
on 25 Mar 2013

Hi Walter,
I had seen that too but the information refers to an older version of the NI-DAQmx Base driver set. Version 3.6 that I'm using should be compatible with a 64-bit kernel: http://digital.ni.com/public.nsf/allkb/658ADEBAC59B812A8625789B00502DA1
I can't believe that updating to newer software makes solving a task just harder instead of easier… And given that, in the meantime, there are quite a few Mac users out there (particularly in the scientific community): Why has the data acquisition toolbox still not been ported to OSX?
Thanks, Robert

  1 Comment

Sorry, NI requires an account to download the base driver set, so I cannot test it here.
I have no idea why the DAQ is not available on OS-X -- I had thought it was available; guess I didn't look carefully before.

Sign in to comment.