matlab 中的 SPM:如何在 Batch Editor 中调用 matlab 函数

SPM in matlab: how to call matlab function in Batch Editor

我正在使用 matlab 在 SPM8 中使用批处理编辑器编写批处理。现在我想包含一个我自己编写的简单 matlab 函数。我确保这个函数保存在 SPM 的路径中。作为输入变量,该函数使用批处理中上一步的文件,当我指定要调用的函数时,它显示 "Input could not be evaluated".

所以现在我正在尝试让另一个简单的函数在 SPM 批处理中工作,例如 "sqrt"。我将 "Evaluated Input" 设为 25,将 "Type of output variable" 设为实数,将 "Function to be called" 设为 sqrt。再次出现一条错误消息,显示 "Input could not be evaluated".

我做错了什么?

在单引号中输入函数如下: 'sqrt'

我刚刚试过了,很有效。

您的批处理文件最终应如下所示:

matlabbatch{1}.cfg_basicio.run_ops.call_matlab.inputs{1}.evaluated = 25;
matlabbatch{1}.cfg_basicio.run_ops.call_matlab.outputs{1}.strtype.r = true;
matlabbatch{1}.cfg_basicio.run_ops.call_matlab.fun = 'sqrt';