Passing data from Flash to MATLAB through Javascript

조회 수: 2 (최근 30일)
Matthew Sheen
Matthew Sheen 2015년 1월 6일
답변: ryanmattscott 2016년 4월 7일
I have an Adobe Flash app (on my local machine) which is basically a simulation. I embedded the swf file in an html which receives the needed parameters using javascript callbacks (passed from flash with ExternalInterface). I can put the values in text boxes, etc. I need to get these values into MATLAB.
I understand javascript can talk to MATLAB using the built in web browser. The built-in browser will not run the Flash content, however. I need one of the following:
A. (best) A way for Flash to run in MATLAB's web browser. I am on a mac if that's relevant.
B. A way to do the "matlab:[command]" javascript calls from firefox, chrome, or any other.
OR
C. A clever trick to send values from a browser to MATLAB.
Thanks!
  댓글 수: 2
Guillaume
Guillaume 2015년 1월 6일
편집: Guillaume 2015년 1월 6일
I would think that a browser being able to execute commands in matlab would be a very serious vulnerability. Most likely, it's not possible by design.
Matthew Sheen
Matthew Sheen 2015년 1월 9일
The browser doesn't need to run commands in Matlab -- actually matlab just needs to read information from the browser. I'm nearly positive this could be done using UDP, but that seems way too complicated for a simple task.

댓글을 달려면 로그인하십시오.

답변 (2개)

Ajay Pherwani
Ajay Pherwani 2015년 1월 6일
편집: per isakson 2015년 1월 6일
Try something like this:
url = 'http://www.example.com/';
html = urlread(url);
% Use regular expressions to remove undesired markup.
txt = regexprep(html,'<script.*?/script>','');
txt = regexprep(txt,'<style.*?/style>','');
txt = regexprep(txt,'<.*?>','')
you can search in txt further
  댓글 수: 1
Matthew Sheen
Matthew Sheen 2015년 1월 9일
Thanks for the reply. Since the flash app must actually run in the page itself, simply reading the page source won't work.

댓글을 달려면 로그인하십시오.


ryanmattscott
ryanmattscott 2016년 4월 7일
Matt,
I have a similar problem, were you able to figure something out? I could do try to save a file using a php server and then use webread( ) on the url, but I would like to have some handshaking so that I don't webread as php is writing to the file.
- Ryan

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by