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:
Calling Javascript function from Matlab

Subject: Calling Javascript function from Matlab

From: Michele

Date: 13 Oct, 2007 06:06:14

Message: 1 of 4

I have a Z-Wave home automation controller that comes with a
web server that offers up a page with buttons like "ON" and
"OFF" for controlling lights. These buttons run Javascript
functions so for example, when you mouse-click the OFF
button in the browser it runs this Javacript:
onclick="goOff(1);"

I want to control the hardware with Matlab, but my only
interface is via the web server. Is this even possible? Is
there some way for me to have Matlab execute a "goOff(1)"
command or any of the other Javascript functions defined on
the web page?

Seems like it ought to be possible, but I'm drawing a blank
on how to get Matlab to run the Javascript. Any help would
be most appreciated. Thanks!

Subject: Calling Javascript function from Matlab

From: Michele

Date: 20 Oct, 2007 15:43:45

Message: 2 of 4

Hmmm - no replies. Maybe I'm asking the wrong question.
How about this:

Is there a way in Matlab to generate httpWebRequest and
httpWebResponse objects?

Subject: Calling Javascript function from Matlab

From: Yair Altman

Date: 20 Oct, 2007 16:32:46

Message: 3 of 4

"Michele " <denber.nospam@mindspringNOSPAM.com> wrote in
message <ffd7nh$j3p$1@fred.mathworks.com>...
> Hmmm - no replies. Maybe I'm asking the wrong question.
> How about this:
>
> Is there a way in Matlab to generate httpWebRequest and
> httpWebResponse objects?


You might try using Internet Explorer's COM server object
(search this forum for examples - there was even one a few
days ago if I remember correctly). Or use Java's net I/O
classes. Or use Matlab's browser for that matter.

Yair Altman
http://ymasoftware.com

Subject: Calling Javascript function from Matlab

From: Michele

Date: 21 Oct, 2007 06:03:14

Message: 4 of 4


> You might try using Internet Explorer's COM server object
> (search this forum for examples - there was even one a few
> days ago if I remember correctly). Or use Java's net I/O
> classes. Or use Matlab's browser for that matter.

Thankw very much for the suggestions. I started off trying
to do a web call, but the page I need is password protected.
 This is similar to the problem I had earlier with urlread.
 Unfortunately, unlike urlread, all web seems to do is call
ibrowse(html_file), and ibrowse is a dll.

I also tried searching for "IE com server object" and it
told me those were all common terms and wouldn't give me any
results.

Tags for 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