Error in returnindex (line 2) n=length(X);
Output argument "ind" (and maybe others) not assigned during call to "returnindex".
Error in BinData (line 28) Y(i,1)=returnindex(X(i),Value)-1;

 Réponse acceptée

Fangjun Jiang
Fangjun Jiang le 26 Sep 2018

0 votes

Need your returnindex.m to see the problem. Most likely, it has a output argument called "ind" but was not assigned.

4 commentaires

hanif hamden
hanif hamden le 27 Sep 2018
Modifié(e) : Fangjun Jiang le 27 Sep 2018
function ind=returnindex(c,X)
n=length(X);
for i = 1 : n
Y = X(i,1);
if Y > c
ind = i;
break;
end
end
this is my returnindex.m
clear; clc
%Input Value=dlmread('std_tx.asc'); mValue=max(Value(:,1)); n=length(Value);
%Bin Data for every two(2)km C=0; for j=2 : 2 : mValue C=C+1; X(C)=j; end
C1=0;
for P=1: 2 : mValue
C1=C1+1;
X1(C1)=P;
end
X=X'; X1=X1';
n1=length(X); Y=ones(n1,1); for i=1 : n1 Y(i,1)=returnindex(X(i),Value)-1; end
n2=length(X1); Y1=ones(n2,1); for i=1 : n2 Y1(i,1)=returnindex2(X1(i),Value); end
for i=1 : n1
%fprintf('%.f : %.f\n',Y1(i,1),Y(i,1));
end
std=ones(n1,1); stdValue=Value(:,2); for i=1 : n1 std(i,1)=mean(stdValue(Y1(i,1):Y(i,1))); end
% %OUTPUT
fid1=fopen('std_txR.asc','w'); %std_txR.asc fprintf(fid1,'Mean-Dist(km) Mean-Std(m)\n');
for i=1 : n1 fprintf(fid1,'%d %.5f\n',X(i),std(i,1)); end fclose(fid1);
this is overall script actually.
Fangjun Jiang
Fangjun Jiang le 27 Sep 2018
in returnindex.m, based on the condition, "ind" could never be evaluated.
hanif hamden
hanif hamden le 3 Oct 2018
Yes. it is due to arrangement of the data. I found the solution. Thanks btw

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by