Error using ''error'' - not enough input arguments
이전 댓글 표시
Hi all!
I am running a script in MATLAB r2021b but obtain the following eror message:
Error using error
Not enough input arguments.
Error in ivana_rsfa_logtransform (line 36)
error;
Below I have pasted my code and you can see the error I get. Any advice would be very useful. I have attached comments in the script so that you understand what I am trying to do. :)
Thank you!
Ivana
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
답변 (1개)
Walter Roberson
2022년 10월 11일
0 개 추천
error() must be followed by at least one parameter which is the error message. It might be followed by additional parameters.
카테고리
도움말 센터 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!