From: Ali Culp on
I have a program called dcm2nii.exe and in order to run it I need to include input arguments. How can I do this automatically through matlab??

When just using cmd here's what I do:
cd C:\Documents and Settings\Administrator\Desktop\Ali\mricron
dcm2nii -o C:\Vesta C:\Vesta (where dcm2nii is the exe file, -o C:\Vesta and C:\Vesta are two input arguments)

I'm really new to using matlab so if you could help me out step by step I'd really appreciate it!
From: us on
"Ali Culp" <aliculp(a)hotmail.com> wrote in message <hs9ft8$6k0$1(a)fred.mathworks.com>...
> I have a program called dcm2nii.exe and in order to run it I need to include input arguments. How can I do this automatically through matlab??
>
> When just using cmd here's what I do:
> cd C:\Documents and Settings\Administrator\Desktop\Ali\mricron
> dcm2nii -o C:\Vesta C:\Vesta (where dcm2nii is the exe file, -o C:\Vesta and C:\Vesta are two input arguments)
>
> I'm really new to using matlab so if you could help me out step by step I'd really appreciate it!

a hint:
- this has been discussed the other day...

http://www.mathworks.com/matlabcentral/newsreader/view_thread/281645

us
From: Ali Culp on
I've tried using that code but am getting a few error messages along the way...

For fprintf('%s %s %s',fid,s1,s2) (where s1/s2 are my two input parameters), it changes my command line such that:

-o C:\Vesta C:\Vesta>>

is what is looks like. Then when I type fclose(fid) it says invalid fid.

Also, when I type the system(['C:\Documents and Settings\Administrator\Desktop\Ali\mricron\dcm2nii.exe<'fname]) it says I'm missing a matlab operator at the fname section.
From: TideMan on
On May 11, 6:22 am, "Ali Culp" <alic...(a)hotmail.com> wrote:
> I've tried using that code but am getting a few error messages along the way...
>
> For fprintf('%s %s %s',fid,s1,s2) (where s1/s2 are my two input parameters), it changes my command line such that:
>
> -o C:\Vesta C:\Vesta>>
>
> is what is looks like. Then when I type fclose(fid) it says invalid fid.
>
> Also, when I type the system(['C:\Documents and Settings\Administrator\Desktop\Ali\mricron\dcm2nii.exe<'fname]) it says I'm missing a matlab operator at the fname section.

Well why not simply reproduce exactly what you do in DOS?
system('dcm2nii -o C:\Vesta C:\Vesta')
This assumes you have dcm2nii in the path.
If not, then assuming dcm2nii.exe is in the directory, you could do
this:
pgm='"C:\Documents and Settings\Administrator\Desktop\Ali\mricron
\dcm2nii"';
then:
system([pgm ' -o C:\Vesta C:\Vesta'])
Note: I think you'll need double quotes because of the spaces in the
directory name.
From: Ali Culp on

> Well why not simply reproduce exactly what you do in DOS?
> system('dcm2nii -o C:\Vesta C:\Vesta')
> This assumes you have dcm2nii in the path.
> If not, then assuming dcm2nii.exe is in the directory, you could do
> this:
> pgm='"C:\Documents and Settings\Administrator\Desktop\Ali\mricron
> \dcm2nii"';
> then:
> system([pgm ' -o C:\Vesta C:\Vesta'])
> Note: I think you'll need double quotes because of the spaces in the
> directory name.

The problem is there are TWO commands that I have to give DOS...the first is to change where it's looking for the file >>cd C:\Documents...\mricron and the second is to tell it to run the dcm2nii program >>dcm2nii -o C:\Vesta C:\Vesta. Is there a way that I can do something like this in matlab: >>system('command 1','command 2')? If so let me know how!!