function (input,output) with system()

  • Follow


I'm trying to make a matlab script into a function, but the input/output variables fall within the system() command so it isn't recognizing them as variables. Any ideas how I can get around this?

Here's basically how it looks:
function file(input,output)
system(input output)
0
Reply Ali 5/11/2010 4:00:24 PM

Ali Culp wrote:
> I'm trying to make a matlab script into a function, but the input/output 
> variables fall within the system() command so it isn't recognizing them 
> as variables. Any ideas how I can get around this?
> 
> Here's basically how it looks:
> function file(input,output)
> system(input output)

Your question is fairly unclear. You might perhaps be wanting

system([input output])

or

sytem([input ' ' output])

or

system(['SomeCommandHere ', num2str(input), ' > ', output])

or any of a number of other possibilities.
0
Reply Walter 5/11/2010 4:19:11 PM


Well the exact command is:
system('dcm2nii -o OutputFolder InputFolder') where the OutputFolder and InputFolder will be the two changing variables that I want to put in the function.
0
Reply Ali 5/11/2010 4:29:23 PM

Ali Culp wrote:
> Well the exact command is:
> system('dcm2nii -o OutputFolder InputFolder') where the OutputFolder and 
> InputFolder will be the two changing variables that I want to put in the 
> function.

system(sprintf('dcm2nii -o %s %s', output, input));
0
Reply Walter 5/11/2010 4:51:22 PM

Perfect, thanks!!
0
Reply Ali 5/11/2010 5:22:22 PM

4 Replies
146 Views

(page loaded in 0.388 seconds)

Similiar Articles:













7/7/2012 12:42:45 PM


Reply: