Open Firefox or Chrome from Matlab script on Linux
Ältere Kommentare anzeigen
So I had what I thought was a good idea that has come back to bite me during cross platform testing.
I put little ? icons all over the GUI for context sensitive help. Since the boss is pushing hard for a release, I figured this was a good way to be able to distribute the program while we enhanced the context sensitive help and documentation. (The program uses the web for data transfers anyway).
The problem is in Linux specifically Ubuntu 11.04 and Scientific Linux 6.1 (a Fedora derivative)
stat = web (url, '-browser')
works fine on MacOS and Windows but on linux it returns 0 signifying "Browser was found and launched." see http://www.mathworks.com/help/techdoc/ref/web.html
BUT no browser opens. Preferences->Web is set to firefox or chromium-browser or /usr/bin/firefox or /usr/bin/chromium-browser
All of those commands work just fine from the terminal windows I use to launch Matlab and from the GNOME application launch panel.
Running: [stat,result]=system('firefox www.matworks.com') does give error messages indicating some dynamic libraries are not found.
I assume that the problem with the web function also.
Anyone know how to fix this in a hopefully general way that doesn't rely on my startup script parsing the entire /etc/ld.so.conf.d directory and populating LD_LIBRARY_PATH?
Thanks,
Joe
6 Kommentare
Joseph Areeda
am 24 Feb. 2012
Jason Ross
am 24 Feb. 2012
I would have thought that the browser would have installed all it's required dependencies if you did it using apt (or the package manager). But you should be able to install the older libraries on the system if you need to.
Joseph Areeda
am 24 Feb. 2012
Jason Ross
am 24 Feb. 2012
The systems requirements pages are archived for several releases:
http://www.mathworks.com/support/sysreq/current_release/
for 2009a in particular:
http://www.mathworks.com/support/sysreq/release2009a/linux.html
Joseph Areeda
am 25 Feb. 2012
Jason Ross
am 27 Feb. 2012
I did some digging.
/usr/bin/google-chrome is a sym link to /opt/google/chrome/google-chrome.
/opt/google/chrome/google-chrome is a script. It does a number of things to set the environment and then finally execs the chrome executable.
The chrome executable itself returns a number of libs in /usr/lib and /lib
Antworten (1)
Jason Ross
am 23 Feb. 2012
0 Stimmen
You can check and see how your system "knows" the browser:
I had a similar problem getting links to launch in Chrome, and had to do the above procedure to make my Linux machine launch Chrome when I expected it to. I don't know with 100%% certainty that this will solve your issue, but it's a good place to start.
3 Kommentare
Jason Ross
am 23 Feb. 2012
FWIW I just tried this out with Firefox (really, Iceweasel) and Chrome. The command I used for Chrome was "google-chrome", which resolves to "/usr/bin/google-chrome". In both cases,
web('http://www.google.com', '-browser')
did what I expected, opening the browser to the url indicated.
Joseph Areeda
am 23 Feb. 2012
Jason Ross
am 24 Feb. 2012
Yep. I got mine right from Google by adding it to my sources and installing it using aptitide.
Kategorien
Mehr zu Platform and License finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!