Error using ''error'' - not enough input arguments
Show older comments
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
Answers (1)
Walter Roberson
on 11 Oct 2022
0 votes
error() must be followed by at least one parameter which is the error message. It might be followed by additional parameters.
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!