How do I run a Linux shell command from Octave?

5

1

I want to run commands like pdflatex and cp from an octave script. Is there a way to do that?

pirad

Posted 2011-12-02T06:35:34.133

Reputation: 185

Answers

9

Use the function system(<command>) to call a shell command from Octave. Replace <command> with the command you want to execute. (Note that MATLAB allows a shell command to be executed by prefixing it with an exclamation mark !, but Octave does not support this syntax. See this Wikibooks page for more information.)

bwDraco

Posted 2011-12-02T06:35:34.133

Reputation: 41 701

1

unix(command) is another way to go. If you'd like to get properties of files directories etc. Xoctave does it automatically.

Chris Naber

Posted 2011-12-02T06:35:34.133

Reputation: 31

Just for example: unix('mv *.* ex1/') – nguyenhoai890 – 2018-01-02T06:17:09.503