LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send matrix from cvi to matlab?

How to send matrix from cvi to matlab? I use activex to communicate between labwindows and matlab. But the example in /activex/matlab couldn't work. I have changed the GUID and it can invoke the matlab command panel. But when I transfer matrix from labwindows to matlab,
an error occured saying that it cannot send data to matlab.
My labwindos version is 6.0 while matlab is 7.0.1
If anyone knows the reason, please help me!!! Thank you very much!!!

0 Kudos
Message 1 of 3
(3,281 Views)

Hello eyesonmeme,

Were you able to do the steps in the following KnowledgeBase?  Granted, I wrote this up for Matlab 6.5R13, but on that version the shipping example should work.  The problem is probably due to changes in the Matlab ActiveX object model between version 6.5 and 7.0.1. Could you step through the invertCB function and let me know which function call it fails on?  This might help us find what needs to be changed in order to get this working on Matlab 7.0.1.

Thanks.

Wendy L
LabWindows/CVI Developer Newsletter
0 Kudos
Message 2 of 3
(3,268 Views)
I use CVI 8.0 and Matlab 7.0
I have changed the matlabsrvr.c as you say.
I step the SendStrCB and invertCB fuctions. There are something wrongs when press the SEND STRING button and INVERT MATRIX button, it returns "Error in sending String to MATLAB" and "Error in sending Matrix to MATLAB",
there maybe sime problem in SendMatrix(...) function.
 
I find that something wrong in the program in run in MLApp_DIMLAppPutFullMatrix in Matlabsrvr.c
the code is here:
HRESULT CVIFUNC MLApp_DIMLAppPutFullMatrix (CAObjHandle objectHandle,
                                            ERRORINFO *errorInfo,
                                            const char *name,
                                            const char *workspace, SAFEARRAY *pr,
                                            SAFEARRAY *pi)
{
 HRESULT __result = S_OK;
 unsigned int __paramTypes[] = {CAVT_CSTRING, CAVT_CSTRING,
                                CAVT_DOUBLE | CAVT_ARRAY,
                                CAVT_DOUBLE | CAVT_ARRAY};
 __result = CA_MethodInvokeEx (objectHandle, errorInfo, &IID_IDispatch,
                               0x60010001, CAVT_EMPTY, NULL, 4,
                               __paramTypes, name, workspace, pr, pi);
 return __result;
}
 
after run in the CA_MethodInvokeEx  function, the variable _result change from 0x00000000 to 0x80020009.
 
Hope your reply.
Thank you
0 Kudos
Message 3 of 3
(3,170 Views)