Thread Subject: COM PutFullMatrix Syntax

Subject: COM PutFullMatrix Syntax

From: Matthe Reilly

Date: 10 Oct, 2008 18:15:06

Message: 1 of 3

I am trying to build a model using MATLAB's COM functionality. The software I'm interfacing with has an method AddIntersection, which has the following syntax:

object.AddIntersection (num, num_boundries, boundary_nums())

Thus, it adds object with number num at the intersection of num_boundaries curves where the curves are specified by their internal identification numbers, boudary_nums. I have been unable to successfully send the array of boundary_nums to the software. After contacting the software provider, they have indicated that boundary_nums must be of the SafeArray type, which MATLAB's documentation indicates may be passed using the PutFullMatrix function. I tried to do this with the following command line:

object.AddIntersection(1,2,COMApp.PutFullMatrix('M','global',[1,2],[0,0]))

which returned the error

??? No appropriate method or public field PutFullMatrix for class COM.application.

Does anyone have any experience attempting to use the PutFullMatrix command as an argument in another COM method? I just can't seem to find the correct syntax that will allow this to work.

Thanks
Matt

Subject: COM PutFullMatrix Syntax

From: rtServo

Date: 11 Oct, 2008 20:35:51

Message: 2 of 3

Matt -

The help on TMW web site is pretty good for using Matlab as a COM
server, complete with examples.

What does Matlab show as the method signature for AddIntersection?
(try object.invoke or object.methods.) I expect you will see that
the third parameter is a Variant or a SafeArray of some type..

Have you tried:

object.AddIntersection(1, 2, [1,2])

Matlab will usually take care of creating the SafeArray for you. If
that failed, what was the error message?

Is COMApp a Matlab Automation object? If so, you have probably opened
a second instance of Matlab. I did this:

COMapp = actxserver('Matlab.Application.7');

and that created a second instance of Matlab as a COM server.

COMapp.PutFullMatrix('M','global',[1,2],[0,0]);

That created the array M as a global variable in the other instance.
But the error you got suggests COMapp is something else.

rt

On Fri, 10 Oct 2008 18:15:06 +0000 (UTC), "Matthe Reilly"
<matthew.reilly@gmail.com> wrote:

>I am trying to build a model using MATLAB's COM functionality. The software I'm interfacing with has an method AddIntersection, which has the following syntax:
>
>object.AddIntersection (num, num_boundries, boundary_nums())
>
>Thus, it adds object with number num at the intersection of num_boundaries curves where the curves are specified by their internal identification numbers, boudary_nums. I have been unable to successfully send the array of boundary_nums to the software. After contacting the software provider, they have indicated that boundary_nums must be of the SafeArray type, which MATLAB's documentation indicates may be passed using the PutFullMatrix function. I tried to do this with the following command line:
>
>object.AddIntersection(1,2,COMApp.PutFullMatrix('M','global',[1,2],[0,0]))
>
>which returned the error
>
>??? No appropriate method or public field PutFullMatrix for class COM.application.
>
>Does anyone have any experience attempting to use the PutFullMatrix command as an argument in another COM method? I just can't seem to find the correct syntax that will allow this to work.
>
>Thanks
>Matt

Subject: COM PutFullMatrix Syntax

From: Matthew Reilly

Date: 13 Oct, 2008 06:08:06

Message: 3 of 3

rtServo <noone@nowhere.com> wrote in message ...

rtServo,

I'm running another program (finite element software) as an ActiveX server

sc=actxserver('StressCheck.application');

Like I mentioned, the third parameter is a SafeArray. I had tried to send it using
object.AddIntersection(1,2,[1,2])

without success prior to asking for help from the developer. The error message it gives is "??? Error: Type mismatch, argument 3." The COMApp's developer indicated that it required a safearray and suggested a workaround

object.AddIntersection(1,2,[int32(1),int32(2)])

which appears to work in most cases. However, it is giving me strange results in other cases. The only rhyme or reason I can find is that it is usually having problems when the elements in the safearray are the numbers 15 or 5, which doesn't make any sense to me at all.

Thanks for the feedback and I would appreciate any more help you can give me. The developer of the application I'm using doesn't have experience with MATLAB for COM, as they have only dealt with VB previously. They're trying to help, but it's taking quite a while.

Thanks
Matt

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
com Matthew Reilly 10 Oct, 2008 14:20:06
putfullmatrix Matthew Reilly 10 Oct, 2008 14:20:06
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com