Invoke Error, Dispatch Exception: Exception Error Occurred

49 Ansichten (letzte 30 Tage)
Peeyush
Peeyush am 26 Apr. 2012
Kommentiert: supriya Naik am 10 Mai 2022
Hi,
After creating a .COM object for SAP2000 from MATLAB I run a for loop with one API command. The loop looks something like this:
for i = 1:333
[a b c] = SAPObject.SAPModel.APIcommand(input arugments);
end
I am trying to run this code when this occurs:
"Interface.a string of numbers and letters/API command"
"Invoke Error, Dispatch Exception: Exception Error Occurred"
What's surprising if I run the for loop for any one number, say "i = 1" or "i = 4", and it runs successfully but when I try to loop through a range of numbers, it generates error.
Thanks in advance for your help.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 26 Apr. 2012
This isn't necessarily a MATLAB issue: COM interfaces can be sensitive to 32 vs 64 bit.
You can write your code to detect 32 vs 64 bit: http://www.mathworks.com/support/solutions/en/data/1-2HBX9L/index.html?solution=1-2HBX9L . With all the currently supported versions, if computer() or mexext() end in '64' then you have a 64 bit version and otherwise you have a 32 bit version. You can use this information to set typename strings for use with ones() or zeros() or cast() or NaN() or inf()

Weitere Antworten (1)

Peeyush
Peeyush am 26 Apr. 2012
I figured out a crude solution. I wrote and tested the code in a 32 bit machine and I was running into problems when running the program on a 64 bit machine.
In intializing variables at two places, I was previously using 'int32' declaration. On a 64 bit machine, when I use 'int64' it works fine.
I would really appreciate if someone could tell if I can run the original code written on a 32bit machine on a 64 bit machine without having to make edits within the program, say by changing MATLAB setting to 32 bit? Is that possible?
  2 Kommentare
Guy Reading
Guy Reading am 12 Jun. 2019
I realise this was asked a long time ago, but just in case others are looking for help here, I believe the problem may be in where you're registering your .com object.
There's a folder for 64 bit objects and another folder for 32 bit. This is in the (Windows) OS architecture, nothing to do with MATLAB, but you'll need to register the .com object in the right folder.
For 32 bit, it's C:\Windows\SysWOW64.
For 64 bit, it's C:\Windows\System32
This may help, I'd also invite you to research this independently as I'm not an expert with this, but it helped me a few times in the past.
supriya Naik
supriya Naik am 10 Mai 2022
Error using Interface.4E4ADE7E_0FB6_430F_9D1B_1A66C6A69953/GetPropertyValue
Error: Object returned error code: 0x80070202
Can you explain what is the meaning of this error, during ansys matlab interfacing?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Use COM Objects in MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by