Error in using prctile, not enough input arguments.

1 次查看(过去 30 天)
hello
dose anyone knows why i get this error message (error in using prctile,line 54 not enough input arguments)? I am trying to run this code but I am ery new to using Matlab.
for i=1:length(A)
Pks{i}=CPM_peak_chkcai(Q(:,i),p1(i),p2(i),p3(i),p4(i),BF{i}.RePs,BF{i}.f,BF{i}.Qelp);
minPeak = prctile(Q(:,i),prctile);
Pks{i}(Q(Pks{i})<minPeak)=[];% revised 1, to remove small floods
% Formation of flow hydrologic events
Pks{i}(Pks{i}<min(BF{i}.RiPs))=[];% revised 2, remove peaks has no rising part due to the limited time span.
Pks{i}(Pks{i}>max(BF{i}.RePs))=[];
FE{i}=CPM_FE_chkcaiV2(Pks{i},BF{i}.RiPs,BF{i}.RePs);
% FE{i}=CPM_FE(Pks{i},BF{i}.RiPs,BF{i}.RePs);
end
% S=matfile([path 'RFE_Swift'],'Writable',true);
% S.FE=FE;
sh=cell(1,length(A));
eh=cell(1,length(A));
for i=1:length(A)
%% moved from Events_Matching5
% rules to remove events with high start or end flow
if ~isempty(FE{i}.MPEs)
mph=zeros(size(FE{i}.MPEs,1),1);% peak locations of multi-peak events
for ie=1:length(mph)
[~,mph(ie)]=max(Q(FE{i}.MPEs(ie,1):FE{i}.MPEs(ie,2)));
mph(ie)=mph(ie)+FE{i}.MPEs(ie,1)-1;
end
indexRemove=Q(FE{i}.MPEs(:,1))./Q(mph)>IBFIm(size(IBFIm,1),i) | Q(FE{i}.MPEs(:,2))./Q(mph)>IBFIm(size(IBFIm,1),i);
FE{i}.MPEs(indexRemove,:)=[];
FE{i}.MPEP(indexRemove,:)=[];
MPEs1=FE{i}.MPEs(:,1);
MPEs2=FE{i}.MPEs(:,2);
else
MPEs1=[];
MPEs2=[];
end
if ~isempty(FE{i}.SPEs)
sph=zeros(size(FE{i}.SPEs,1),1); %peak locations of single-peak events
for ie=1:length(sph)
[~,sph(ie)]=max(Q(FE{i}.SPEs(ie,1):FE{i}.SPEs(ie,3)));
sph(ie)=sph(ie)+FE{i}.SPEs(ie,1)-1;
end
thanks
  1 个评论
Michael Soskind
Michael Soskind 2021-3-18
Hello Hazhan,
Although your code cannot be run as you have provided, and there are not 54 lines of code in the sample, it looks as though you have a variable prctile, which also happens to be a built in matlab function. You should limit this ambiguity. The line I am referring to is the one below.
minPeak = prctile(Q(:,i),prctile);
Let me know if changing the prctile variable to a different name and initializing it helps.

请先登录,再进行评论。

回答(1 个)

the cyclist
the cyclist 2021-3-18
This line is confusing to me, and is likely where the problem is:
minPeak = prctile(Q(:,i),prctile);
You are trying to use prctile as both a function and a variable name. As the argument to the function, you should instead use a value (lilke 95), or a different variable name, like prctVal.

Community Treasure Hunt

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

Start Hunting!

Translated by