Too many output arguments using histogram function

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 日

1 投票

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 日

0 投票

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.

カテゴリ

製品

リリース

R2019b

質問済み:

2021 年 5 月 25 日

コメント済み:

2021 年 5 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by