使用‘’Error‘’时出错-输入参数不足(MatLab R2021B)

qcuzuvrc  于 2022-11-15  发布在  Matlab
关注(0)|答案(1)|浏览(375)

我正在运行matlab r2021b中的脚本,但获得以下错误消息:

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
0wi1tuuw

0wi1tuuw1#

此错误意味着您没有为函数提供足够的输入参数。您需要为该函数提供更多信息才能正确运行它。

相关问题