How do I run a linux module from the Command line in Matlab?

14 ビュー (過去 30 日間)
Kurtis Ford
Kurtis Ford 2011 年 4 月 1 日
I am running Matlab on a linux machine. I would like to run a linux module in a Matlab script. When I type "! module" in the command line Matlab retruns "/bin/bash: module command not found" When I open a linux terminal in the same directory the command "module" works as expeted. What am I doing wrong?
Can Matlab run linux modules?

回答 (2 件)

Sean de Wolski
Sean de Wolski 2011 年 4 月 1 日
Call the command through the MATLAB function unix()
doc unix
from the MATLAB command line.
  4 件のコメント
Kurtis Ford
Kurtis Ford 2011 年 4 月 1 日
All of those work just fine. I just talked to the tech guys and they say it may be related to an automonous systems issue that our system is having.
Jan
Jan 2011 年 4 月 1 日
Perhaps the PATH is incomplete? "getenv('PATH')" could reveal this, I assume.

サインインしてコメントする。


Jason Ross
Jason Ross 2011 年 4 月 1 日
It sounds like the environment that you get in your command shell and the one that's launching MATLAB is different. If you compare outputs "set" in your terminal and from unix('set') in MATLAB, you'll likely find that there are differing path settings that prevent "module" from being found.
A quick test you could do is to run "which module" in your terminal. This will tell you where "module" lives. Then you can see if that directory is on the PATH in the output of the unix('set') command from MATLAB.
Why these would differ can be any of a number of reasons, but hopefully this would help your systems people sort it out.

カテゴリ

Help Center および File ExchangeModulation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by