applying unix commands in matlab
5 ビュー (過去 30 日間)
古いコメントを表示
I have been trying to apply unix commands in the MATLAB environment but it is not working. For example, if I enter this simple command to display the environment variable PATH, the following is the output:
[status, cmdout]=unix('echo $PATH')
status =
0
cmdout =
$PATH
When I apply this same command in cygwin, it gives me a long output pointing to the correct directory. What do I need to do to fix this?
3 件のコメント
Daniel Shub
2013 年 8 月 14 日
I don't have the documentation in front of me, but I am pretty sure the MATLAB UNIX command is not magically and does not give you access to UNIX from a Windows machine.
採用された回答
Walter Roberson
2013 年 8 月 14 日
The unix() command does not deliberately pass the command to a Unix command shell. The unix() command and system() command and dos() command are identical (or very nearly so), and all three of them pass the command to the "system shell". Which, on MS Windows, is "cmd.com" or "cmd.exe" or whatever the 64 bit equivalent name is.
If I recall old MS Windows information properly,
system('print PATH')
Note: if you are calling to the system just to look at environment variables, then instead use MATLAB's getenv()
getenv('PATH')
7 件のコメント
Walter Roberson
2013 年 8 月 15 日
編集済み: Walter Roberson
2013 年 8 月 15 日
system(sprintf('a.exe ''%s'' > ''%s''', FileIn{i}, FileOut{i})
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Software Development Tools についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!