使用错误时出错 - 输入参数不足 (Matlab R2021B)



我正在MATLAB r2021b中运行一个脚本,但获得了以下eror消息:

Error using error
Not enough input arguments.
Error in ivana_rsfa_logtransform (line 36)
error;

下面我已经粘贴了我的代码,你可以看到我得到的错误。任何建议都是非常有用的。我在脚本中附上了评论,这样你就可以理解我想做什么了。:(

rootdir = 'home/ivana/brain_scans';
for isub = 1:size(T1,1) % the data of my subjects are found in a table T1
fn  = T1.f_rsfa{isub}; % fn is a variable containing subject's paths to folders with brain scans
V   = spm_vol(fn) ;% variable fn needs to go into the spm_vol function in order to perform a transformation of the brain scans
Y   = spm_read_vols(V); 
%% function to read in entire image volume- FORMAT [Y,XYZmm] = spm_read_vols(V,mask), where V is vector of mapped image volumes
% to read in (from spm_vol) and mask is an implicit zero mask.
% Y is a 4D matrix of image data, fourth dimension indexes images.

% spm_write_vol is a function to write an image volume to disk, setting scales and offsets as appropriate. The format is V = spm_write_vol(V,Y),where:
%   V (input)  - a structure containing image volume information (see spm_vol)
%   Y - a one, two or three dimensional matrix containing the image voxels
%   V (output) - data structure after modification for writing.
idx = Y>0; % due to possible NaNs and 0s, we create a mask to only log transform images with + values
if sum(Y(:)<0)
error; % this is where I get the error
end
Ylog = Y;
Ylog(idx) = log(Y(idx));
Vtemp = V;
Vtemp.fname = fullfile(rootdir,[Vtemp.fname]);% give filename and fullpath for the new image
spm_write_vol(Vtemp,Ylog);
end

此错误表示您没有为函数提供足够的输入参数。您需要向函数提供更多信息,以便正确运行它。

相关内容

  • 没有找到相关文章

最新更新