02-24-2010 07:44 PM
Don't see why one should need Matlab insturment control toolbox when the Visa32.dll should be able to be called and used in Matlab directly. Help start this off please.
loadlibrary('C:\WINDOWS\system32\visa32.dll','C:\Program Files\IVI Foundation\VISA\WinNT\include\visa.h','alias','visa32');
not sure what to do with defaultRm
Must be something like
calllib('visa32', 'viOpenDefaultRM', defaultRm)
calllib('visa32', 'viOpen', defaultRm, 'GPIB0::22::INSTR', 0,0, vi)
Can't figure it out and need help from a matlab and C guru. Shouldn't be hard for someone that knows matlab and C real well.
02-25-2010 01:52 PM
Hi Brian,
I don't know to call the DLL from MATLAB, but you should be able to run C code from MATLAB. There all several C examples that ship with VISA that you may want to take a look at. They use the C API for NI-VISA, they don't call into the DLL directly.
Regards,
Todd V
02-25-2010 04:51 PM - edited 02-25-2010 04:52 PM
Yes I know about c and Matlab. Doesn't work for for two reasons. 1) C requires MexFunctions (yuck) 2) Matlab changes how the Mex Functions work sometimes between versions.
I feel that Direct DLL calls are the only sensible way to do this. I know it is possible because I've seen it done with straight GPIB. For example see the link below
http://code.google.com/p/ni-gpib-matlab-wrappers/wiki/dll_loading
I want to do the same with VISA but there are some C to matlab topics I am not sure I understand. I know that somone out there who knows C & matlab can help me a little here.
I can almost get a session open. I watch it in Ni-Spy.
02-25-2010 05:04 PM
Hi Brian,
I would recommend posting to a MATLAB forum for this issue. Hopefully someone can help you on this here, but you can probably get more help on using MATLAB on their forums.
Regards,
Todd V