Plot separate histograms.

7 ビュー (過去 30 日間)
Shaibal Ahmed
Shaibal Ahmed 2016 年 4 月 25 日
コメント済み: Nikhil Vyas 2016 年 5 月 3 日
Hi, I want to plot two separate histograms for the following data. A histogram having values more than zero from the column in the far right corner and another one when the value is zero. Any help is much appreciated. Thank you.
St-1 St-2 St-3 Number
% Date Temp Temp Temp
% YYYYMMDD [°C] [°C] [°C]
20060301 17.6 18.8 20.2 1
20060302 17.4 18.3 19.3 2
20060303 17.7 18.6 18.5 2
20060304 18.5 17.8 19.7 0
20060305 16.5 17.8 17.9 0
20060306 17.6 18.4 18.4 1
20060307 18.1 21.6 19.9 2
...

採用された回答

Nikhil Vyas
Nikhil Vyas 2016 年 4 月 28 日
Assuming this is a n x 5 matrix, the following commands will give you separate matrices based on your condition.
% x being your initial matrix
matrix_non_zero = x(x(:, 5) > 0, :);
matrix_zero = x(x(:, 5) == 0, :);
Now you can plot an histogram for these matrices based on your requirements.
  2 件のコメント
Shaibal Ahmed
Shaibal Ahmed 2016 年 4 月 28 日
Hi, thanks. I did the same thing. But I was wondering if it would be possible to implement a for loop for this problem?
Nikhil Vyas
Nikhil Vyas 2016 年 5 月 3 日
MATLAB is optimized to work with the way I mentioned. Using loops is generally discouraged. :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeHistograms についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by