Error in vector dimension, and too many outputs. How can I make this easier?
1 回表示 (過去 30 日間)
古いコメントを表示
Can anyone help me please? I have tried different types of vectors and it doesn't work. I am getting two errors, first:
??? Undefined function or method 'Sqrt' for input arguments of type 'double' and then too many outputs. I would really appreciate if anyone could tell me an example of the vectors and if there is any other mistake. Thanks
V=reshape(V,length(V),1);
alpha = alpha/2; %
n=length(V);
i=0;S=0;
for i=1:n-1
S = S + sum(sign(V(i+1:n) - V(i)));
end
h=1;
while ~isempty(V)
g=find(V==V(1));
tp=length(g);
Sum(h)=tp*(tp-1)*(2*tp+5);
V(g)= [];
h=h+1;
end
VarS=((n*(n-1)*(2*n-5))-sum(Sum))/18;
%Standard deviation
De=Sqrt(VarS);
If S>=0;
Z= ((S-1)/De)*(S~=0);
else
z= ((S+1)/De);
end
p_value=2*(1-normcdf(abs(z),0,1)); % tail on both sides
pz=norminv(1-alpha,0,1);
H=abs(z)>pz;
return
0 件のコメント
回答 (1 件)
Guillaume
2015 年 5 月 23 日
I've not checked your code for the validity of your inputs, but the main reason for 'the undefined function xxx for input argument of type yyy' is usually because function xxx is misspelled or not on the path. 99% of the cases it has nothing to do with the argument type.
In your particular case, the square root function is spelled sqrt with a lowercase 's'. Therefore,
De = sqrt(VarS);
should solve the issue.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Oceanography and Hydrology についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!