From: Marc Lalancette on
Hi,

Anybody have any idea why a system call would wait forever and do nothing? I get that with this specific command line program (dcm2nii, available for free and no installation required: http://www.cabiatl.com/mricro/mricron/install.html). It even happens when no arguments are given and it's supposed to do nothing but print out the program usage. The only "special" thing that it seems to do is read (and/or write) a configuration file located in: /home/username/.mricron/ which I've given all permissions (rwx) to everyone. (I'm on a fresh Linux installation, Fedora 12.) Also it used to work under my old setup (Fedora 7).

Why would it work from the shell but not from within Matlab? What's different?

Thanks!
Marc
From: Walter Roberson on
Marc Lalancette wrote:

> Anybody have any idea why a system call would wait forever and do
> nothing? I get that with this specific command line program (dcm2nii,

It is waiting for the user to close the DOS console that it generated to run
within, because the user might want to see the outputs.

I gather from the documentation (but not experience) that this is more
probable when you use dos() to invoke the command rather than system().
From: Marc Lalancette on
> It is waiting for the user to close the DOS console that it generated to run
> within, because the user might want to see the outputs.
>
> I gather from the documentation (but not experience) that this is more
> probable when you use dos() to invoke the command rather than system().

Thanks for your reply. However, from my experience I thought this would only happen if the program was waiting for user interaction, which doesn't occur when I run it from the command line. Also, if I understand correctly, you mean that this console is hidden right? Is there any way to view it? Oh and I was using system(), but dos() does the same.

I also just found that adding an & at the end of the command works. But that is a poor fix because now I have to estimate how long it takes to run and add a pause statement after the call otherwise my script fails.

Cheers,
Marc