COM Object needs to be initialized properly
이전 댓글 표시
I am connecting to a COM object (Bode Analyzer 100 from Omicron). However, since I am making a GUI, I need to initialize these variables to be empty so that I can pass them from function to function. However when I do, matlab complains that they are not the right type of variable. What type is this?
These are the 3 commands I use:
automationInterface = actxserver('OmicronLab.VectorNetworkAnalysis.AutomationInterface')
bode = automationInterface.Connect();
OnePortMeasurement=bode.Impedance.CreateOnePortMeasurement;
Thanks, Sarah
댓글 수: 6
Geoff Hayes
2018년 8월 29일
Sarah - can you show the line (or lines) of code that are responsible for generating the error? Are you creating your GUI with GUIDE and so are updating the handles structure with these three variables? Please clarify.
ADragon
2018년 8월 29일
Hi Sarah, as Geoff mentions it would be helpful to know how the error is generated. By the way, the setappdata and getappdata functions are very handy in passing data among GUI windows. Also, unless you are using an older version of Matlab, the actxserver function will try to connect to a running instance of the called application (OmicronLab... in your case). So technically, you could define automationInterface in each one of your functions and not pass anything. AD
Sarah Crimi
2018년 8월 29일
Geoff Hayes
2018년 8월 29일
Sarah - do you have any code that explicitly closes the connection when you close the GUI (via the x button)? If not, then that could be what is missing and you will need to put some code that does this in the GUI close function.
sandeep singh
2018년 11월 26일
Hello
Even i am trying to connect, but i want to know whether it is connected using serial com port
Sarah Crimi
2019년 1월 28일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Use COM Objects in MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!