Why does the ISEQUAL function behave differently in MATLAB from in a deployed COM object created with the MATLAB COM Builder 1.0 (R13) when used with global variable arguments?

1 次查看(过去 30 天)
I have developed MATLAB code in that uses the ISEQUAL function on a global variable to test if the global variable is empty, similar to the following:
function result = test()
global myGlobal;
result = isequal(myGlobal, [])
When I run this code in MATLAB, I see that "result" equals 1, as I would expect.
I then deploy this function as a COM object using the MATLAB COM Builder 1.0 (R13). When I call my COM object from another application, I then see that "result" is equal to 0. This is inconsistent with the behavior of my code running in the MATLAB environment.

采纳的回答

MathWorks Support Team
This bug was corrected as of the MATLAB Builder for COM 1.1 (R14).
There is a bug in the MATLAB COM Builder 1.0 (R13) in the way that the ISEQUAL function with global variable arguments behaves differently in a deployed COM object than it does when used within MATLAB.
To work around this issue using older releases of the MATLAB COM Builder, use the ISEMPTY function to test if global variables are empty, as opposed to the ISEQUAL function.
For example, instead of using this syntax:
res = isequal(myGlobal, [])
use the following syntax:
res = isempty(myGlobal)

更多回答(0 个)

类别

Help CenterFile 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!

Translated by