Too many output arguments using histogram function

조회 수: 7 (최근 30일)
Frank van der Leij
Frank van der Leij 2021년 5월 25일
댓글: Steven Lord 2021년 5월 25일
got a script from someone to calculate SO2 flux from volcanoes using satellite data.
%matS5Pdetect is a matrix (npixel x 14)
matS5Pdetect=[lon1(sel) lon2(sel) lon4(sel) lon3(sel) lat1(sel) lat2(sel) lat4(sel) lat3(sel) SO2VCD(sel) lon5(sel) lat5(sel) secs(sel) row(sel) SO2SCDcor(sel)];
% 1 2 3 4 5 6 7 8 9 10 11 12 13 14
[a, b]=histogram(matS5Pdetect(:,14),50);
[temp, lind]=min(abs(cumsum(a)./sum(a)-0.8));
limitscd=b(lind);% limitscd is the 80 percentile
k=find(matS5Pdetect(:,14)>limitscd); %Based on the 20% largest SO2 slant column, I will estimate a plume direction
if ~isempty(k)
But when I run the code i get this error message:
Error using histogram
Too many output arguments.
Error in S5PSO2_flux_calc_scriptie (line 157)
[a, b]=histogram(matS5Pdetect(:,14),50);
Why does it say too many output arguments? What should i change
  댓글 수: 1
Adam Danz
Adam Danz 2021년 5월 25일
Welcom to the forum. I've edited your question to format your code. In the future please use the code/text toggle in rich text editor to format your code.

댓글을 달려면 로그인하십시오.

답변 (2개)

Steven Lord
Steven Lord 2021년 5월 25일
The histogram function's documentation page states that it returns at most one output argument.
I think what you're looking for is the histcounts function, whose documentation page shows that the first two outputs (for numeric data) are the bin counts and the vector of edges.
Alternately if you have Statistics and Machine Learning Toolbox available, the prctile function may give you the information you want.

Jan
Jan 2021년 5월 25일
The command histogram replies 1 output only.
Unfortunately in your code the outputs are called "a" and "b", such that I cannot guess, what you expect as output. But maybe you mean histcounts instead of histogram.

카테고리

Help CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by