I can't even find the function sqr in my version of matlab. Switch out sqr(i1) and use i1.^2 Make sure you use the ., otherwise it will fail or it will use matrix algebra when you presumably want the element wise solution. 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 Thu, Feb 16, 2012 at 4:44 PM, Andrew Jahn <[log in to unmask]>wrote: > I should also mention that I am trying to do this from the command line > with spm_imcalc_ui. From what I can tell, it appears to be having trouble > evaluating the square of an image, such as sqr(i1). However, I am able to > do this from the SPM GUI ImCalc without any problems. > > Below is the code that I am inputting and the error I am getting: > > > >> P1 = [outputPath 'i1.img']; > >> spm_imcalc_ui([P1], [outputPath 'ip_norm_sqr_i1.img'], 'sqr(i1)') > > SPM5: spm_imcalc_ui (v$Rev: 940 $) 16:43:58 - 16/02/2012 > ======================================================================== > ??? Error using ==> spm_imcalc at 101 > Can't evaluate "sqr(i1)". > > Error in ==> spm_imcalc_ui at 161 > Vo = spm_imcalc(Vi,Vo,f,args); > > > > Thanks, > > -Andrew > > > > On Thu, Feb 16, 2012 at 4:30 PM, Andrew Jahn <[log in to unmask]>wrote: > >> Dear SPMers, >> >> I am attempting to use ImCalc to calculate the square root of sums of >> squares, i.e.: >> >> sqrt(sqr(i1)+sqr(i2)) >> >> However, SPM give me an error when trying to combine these steps. I can >> do them sequentially, but if there is a way that I can combine them, I >> would like to know how. >> >> >> Thanks! >> >> -Andrew >> > >