Jump to content

nosflowm

Members
  • Posts

    1
  • Joined

  • Last visited

    Never

nosflowm's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. OK, I'm having two big problems with ActiveX. Problem #1 is trying to get Matlab to call a LabVIEW app. Simple enough from the LV end, just turn on the VI server. Seems simple enough from the Matlab end: e=actxserver('LabVIEW.Application'); vipath='c:\Documents and Settings\nosflowm\Desktop\testx.vi'; vi=invoke(e,'GetVIReference',vipath); I can run the VI with: vi.Run or vi.Call or vi.Call2 The trouble is I have no idea how to pass parameters to the VI and how to read back the output. I've munged together that I can set the input arguments the hard way: vi.SetControlValue('input variable1',4); But if I try to use the NI suggested method "Call" or "Call2", Matlab chokes on any input parameter I specify: object.Call2([paramNames], [paramVals], [openFP], [closeFPAfterCall], [suspendOnCall])turns into: >> vi.Call2('input variable1',5) ??? Invoke Error, Dispatch Exception: The parameter is incorrect. Any ideas? Problem #2 involves interfacing with a VisualBasic program developed by a third-party for a piece of hardware, and he's really reluctant to help debug anything. I can sort of munge things into working by embedding his OCX into a global variable and have each subVI in my app refer to it. But it just feels wrong, and I have to implement a signaling channel to prevent contention. I should be able to create a reference and pass that between VIs. Only problem is that it fails miserably, giving me Error code -97, and when I probe the line, it has a null reference to the ActiveX interface. That's the easy part. The hard part is that I want to write clean code. That is, I want to initialize the instrument when I start my top level VI and close it when I'm done. But somewhere things don't close out cleanly. Which means that every time I want to test my code, I need to restart LabVIEW, or the ActiveX server thinks that someone else is controlling the hardware interface (4 serial ports). How can I fully close down the ActiveX object without restarting LabVIEW? Sorry if my jargon is off, I've never worked with ActiveX, COM, or NET before. Any help would be appreciated. Thanks, -- MW
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.