I believe the issue is that you are entering a string that contains thresh1, since its a string, it's not looking for a variable. Try changing 'i2.*(i1>thresh1)' to ['i2.*(i1>' thresh1 ')'] Best Regards, Donald McLaren ================= D.G. McLaren, Ph.D. Postdoctoral Research Fellow, GRECC, Bedford VA Research Fellow, Department of Neurology, Massachusetts General Hospital and Harvard Medical School Office: (773) 406-2464 ===================== This e-mail contains CONFIDENTIAL INFORMATION which may contain PROTECTED HEALTHCARE INFORMATION and may also be LEGALLY PRIVILEGED and which is intended only for the use of the individual or entity named above. If the reader of the e-mail is not the intended recipient or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that you are in possession of confidential and privileged information. Any unauthorized use, disclosure, copying or the taking of any action in reliance on the contents of this information is strictly prohibited and may be unlawful. If you have received this e-mail unintentionally, please immediately notify the sender via telephone at (773) 406-2464 or email. On Sun, May 15, 2011 at 6:45 PM, G Elliott Wimmer <[log in to unmask]>wrote: > Hi, > > I'm having a simple problem with spm_imcalc / spm_imcalc_ui. I need to > read in a variable to be used in the imcalc equation. > > The basic idea is to do this: > > spm_imcalc_ui({'input1.img','input2.img'},'output.img','i2.*(i1>thresh1)') > > in a batch script, where 'thresh1' is a value previously calculated for > each subject. The function works if I use a simple number, e.g. '1', in > place of the variable. > > However, adapting the command to read in the extra variable, for example: > > > spm_imcalc({'input1.img','input2.img'},'output.img','i2.*(i1>thresh1)',{[],[],[],[]},thresh1); > > has not worked. I think I must be missing something about the syntax. > (Judging by the lack of questions posted to the board on imcalc and > variables, it's something obvious, or it's a function that SPM people never > use.) > > Thank you for any help! > > Best regards, > > Elliott > > > Dept. of Psychology > Columbia University > New York, NY >