Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Using named arguments in Matlab COM client interface Excel

Subject: Using named arguments in Matlab COM client interface Excel

From: Paul

Date: 29 May, 2012 19:00:15

Message: 1 of 6

Some of the Excel methods (e.g. Sheets.Add) take named arguments. How
can I do this from the Matlab COM client interface?

Subject: Using named arguments in Matlab COM client interface Excel

From: Paul

Date: 29 May, 2012 19:03:59

Message: 2 of 6

Paul wrote:
> Some of the Excel methods (e.g. Sheets.Add) take named arguments.
> How can I do this from the Matlab COM client interface?

I forgot to mention that as of 1998, there was no solution:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/6791

Hopefully, things have changed.

Subject: Using named arguments in Matlab COM client interface Excel

From: reza

Date: 29 May, 2012 20:28:39

Message: 3 of 6

On May 29, 3:03

Subject: Using named arguments in Matlab COM client interface Excel

From: Paul

Date: 29 May, 2012 21:04:56

Message: 4 of 6

On May 29, 4:28

Subject: Using named arguments in Matlab COM client interface Excel

From: Yair Altman

Date: 29 May, 2012 23:29:07

Message: 5 of 6

Paul <paul.domaskis@gmail.com> wrote in message <3e089eb4-5ac5-4139-a813-1a2a91045838@pr3g2000pbb.googlegroups.com>...
> Paul wrote:
> > Some of the Excel methods (e.g. Sheets.Add) take named arguments.
> > How can I do this from the Matlab COM client interface?
>
> I forgot to mention that as of 1998, there was no solution:
> http://www.mathworks.com/matlabcentral/newsreader/view_thread/6791
>
> Hopefully, things have changed.

It's not necessarily that there was no solution since 1998. It could be that back in '98 nobody who knew the answer saw the newsgroup thread and/or bothered to answer. And of course nobody who has a life searches for 14 year-old unanswered threads to answer.

As for my small contribution to this issue, AFAIK there are no named parameters in COM. However, you can often rely on the parameter order and pass [] (empty brackets) to any non-specified parameter. For example:
   expression.Add([], 'AfterName', ...)
I'm not sure it will help your specific case, but it's worth a try.

Also see the following related article:
http://undocumentedmatlab.com/blog/com-activex-tips/

Yair Altman
http;//UndocumentedMatlab.com
 

Subject: Using named arguments in Matlab COM client interface Excel

From: Paul

Date: 29 May, 2012 23:48:54

Message: 6 of 6

On May 29, 7:29 pm, "Yair Altman" <altmany...@gmailDEL.comDEL> wrote:
> Paul <paul.domas...@gmail.com> wrote in message <3e089eb4-5ac5-4139-a813-1a2a91045...@pr3g2000pbb.googlegroups.com>...
>> Some of the Excel methods (e.g. Sheets.Add) take named arguments.
>> How can I do this from the Matlab COM client interface?
>>
>> I forgot to mention that as of 1998, there was no solution:
>> http://www.mathworks.com/matlabcentral/newsreader/view_thread/6791
>>
>> Hopefully, things have changed.
>
> It's not necessarily that there was no solution since 1998. It could
> be that back in '98 nobody who knew the answer saw the newsgroup
> thread and/or bothered to answer. And of course nobody who has a
> life searches for 14 year-old unanswered threads to answer.

Yup, I agree. But it's the only relevant hit I found with respect to
this issue.

> As for my small contribution to this issue, AFAIK there are no named
> parameters in COM. However, you can often rely on the parameter
> order and pass [] (empty brackets) to any non-specified parameter.
> For example:
> expression.Add([], 'AfterName', ...)
> I'm not sure it will help your specific case, but it's worth a try.

Thanks, Yair. I was trying to avoid the lack of self-documentation
inherent in the nameless parameters.

> Also see the following related
> article:http://undocumentedmatlab.com/blog/com-activex-tips

I perused your link with interest. In my experiments, *.item and
invoke() are not as robust *.get('Cells',i,j) when it comes to
accessing cells within a sheet or a range. The article also
recommended dealing with constants instead of the names for the
constants. It is a bit disheartening to see that, since the whole
point of constant names is to protect code against redefinitions of
the constant values. If you use the constant name, you will always
end up with the right value for any particular version of a platform
(or at least, it's the intent).

I'm sure this is motherhood to any coder, but it's the reason for
soberness of the article.

Tags for this Thread

No tags are associated with this thread.

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.

Contact us