The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Help with UNIX() command
Replies: 5   Last Post: Apr 5, 2013 10:43 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Doug Schwarz

Posts: 1,412
Registered: 12/7/04
Re: Help with UNIX() command
Posted: Apr 5, 2013 10:43 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

In article <kjkll5$j6o$>,
"John " <> wrote:

> "Nasser M. Abbasi" wrote in message <kjkl4o$if2$>...
> > On 4/4/2013 2:26 PM, John wrote:
> > > I want to run a shell script within MATLAB, but the script is csh. When
> > > I try running
> > >it in MATLAB it says /bin/bash commande does not exist. How do I get
> > >to run the UNIX command using csh and not bash?
> > >

> >
> > When you explain a problem, it helps to also show what you actually
> > typed. No one can see your screen from here to figure what you
> > typed.
> >
> > But may be this helps
> >
> >
> >
> > "system
> >
> > Execute operating system command and return output"

> [s,w]=unix('to3d -session e126 -prefx 4244_run_01 -epan -time:zt 28 104 1800
> altplus ./s1037/*MRDC*')
> /bin/bash: to3d: command not found
> That is what I run and the error I get. Using system produces the same
> error. The problem is MATLAB is trying to run it through a bash shell, and
> its a command for a c-shell(csh). I need to know how to get MATLAB to
> execute the command in a c-shell. and ! will not work either for the exact
> same reason.

If you really want to execute the command in a c-shell, try

[s,w]=unix('csh -c "to3d -session e126 -prefx 4244_run_01 -epan -time:zt
28 104 1800 altplus ./s1037/*MRDC*"')

but it really just looks like the command t03d isn't on your path (the
posix one). Figure out where that command lives by typing

which to3d

in a shell terminal. Let's say it's in /usr/local/bin. You can add
that directory to the posix path from within MATLAB with something like

current_path = getenv('PATH');
new_path = [current_path,pathsep,'/usr/local/bin'];

which you can put in your startup m-file.

Doug Schwarz
Make obvious changes to get real email address.

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.