Output argument "u" (and maybe others) not assigned during call

1 view (last 30 days)
Error in spm_u (line 23)
if STAT == 'Z'
Output argument "u" (and maybe others) not assigned during call to "C:\spm5\spm5\spm_u.m>spm_u".
Error in spm_getSPM (line 654)
u = spm_u(u^(1/n),df,STAT);
Error in spm_results_ui (line 275)
[SPM,xSPM] = spm_getSPM;
Error while evaluating uicontrol Callback
  • * * * >>
The above error is displayed when I try to load up the SPM.mat file in the 'Results' GUI in SPM5. Below is the spm_u function** * * * *
function [u] = spm_u(a,df,STAT)
% uncorrected critical height threshold at a specified significance level
% FORMAT [u] = spm_u(a,df,STAT)
% a - critical probability - {alpha}
% df - [df{interest} df{error}]
% STAT - Statistical field
% 'Z' - Gaussian field
% 'T' - T - field
% 'X' - Chi squared field
% 'F' - F - field
%
% u - critical height {uncorrected}
%___________________________________________________________________________
% spm_u returns the uncorrected critical threshold at a specified significance
%
%___________________________________________________________________________
% Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
% Karl Friston
% $Id: spm_u.m 707 2006-12-06 16:42:20Z volkmar $
if STAT == 'Z'
u = spm_invNcdf(1 - a );
elseif STAT == 'T'
u = spm_invTcdf(1 - a,df(2));
elseif STAT == 'X'
u = spm_invXcdf(1 - a,df(2));
elseif STAT == 'F'
u = spm_invFcdf(1 - a,df );
elseif STAT == 'P'
u = a;
end

Answers (2)

Walter Roberson
Walter Roberson on 27 Jul 2015
You left out the error message before
Error in spm_u (line 23)
You are probably calling spm_u without passing in three parameters. We would need to see your callback to say more.

Guillaume
Guillaume on 27 Jul 2015
if stat is neither 'Z' , 'T', 'X', 'F' or 'P' then indeed the output u won't be assigned any value.
You can fix the problem with the obscure error message by adding another else condition to your code:
%...your code, ending with:
elseif STAT == 'P'
u = a;
else %error?
error('input argument STAT contains invalid value: %s', STAT);
end
That won't solve the underlying problem that you're passing an invalid STAT value to the function.
By the way, your if...elseif...elseif...else would probably be better written as a switch...case...otherwise statement.

Categories

Find more on Graphics Object Programming 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!