Using NI-VIsa in Matlab without Instrument Control Toolbox
Show older comments
I am trying to establish a Visa session in Matlab without the Instrument Control Toolbox.
Either via COM-Interface or .NET reference. However neither seems to work.
I tried creating COM-Servers with the same DLLs that are used in MS Excel to create a Visa Session (GlobMgr.dll and BasFormIO.dll). I have tried every ProgID i could find in the DLLs but none works. Because every time I run the file Matlab just crashes, logging Access violation detected at "Time I ran the file". However, if i try to create a COM-Server of an own created object it works fine.
So maybe i can't create COM-Interfaces from DLLs or I use the wrong ProgIDs?
visaObj = actxserver('VISA.GlobalRM');
formIO = actxserver('VISA.BasicFormattedIO');
As for the .NET references I added the Ivi.Visa DLL which should already add all dependencies it needs with it. Matlab even tells me Assembly Ivi.Visa.Interop has alread been added from Ivi.Visa.Interop.dll when i try to add it too.
asm1 = NET.addAssembly('C:\Windows\assembly\GAC_MSIL\Ivi.Visa\7.2.0.0__a128c98f1d7717c1\Ivi.Visa.dll');
asm2 = NET.addAssembly('C:\Program Files\IVI Foundation\VISA\VisaCom64\Primary Interop Assemblies\Ivi.Visa.Interop.dll');
I can import the namespaces I need which would be.
import Ivi.Visa.*
import NationalInstruments.Visa.*
import Ivi.Visa.interop.*
import NationalInstruments.Common.*
But as soon as I try to use functions from them Matlab says "Error using Ivi.Visa.Interop.ResourceManager: No constructior 'Ivi.Visa.Interop.ResourceManager' with matching signature found."
rm = ResourceManager();
Which is odd because obviously it understood, that the resource manager is in the Ivi.Visa.Interop namespace.
Has anyone encountered a similar issue and managed to fix it?
1 Comment
Walter Roberson
on 2 Oct 2024
Complete guess:
Maybe the ResourceManager call needs to be passed a parameter?
Answers (1)
Simon
on 3 Oct 2024
Categories
Find more on .NET Data Types in MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!