[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: warning: hist: bin values not sorted on input
From: |
Nicholas Jankowski |
Subject: |
Re: warning: hist: bin values not sorted on input |
Date: |
Tue, 8 Dec 2015 08:53:37 -0500 |
On Tue, Dec 8, 2015 at 7:52 AM, Jonathan Camilleri
<address@hidden> wrote:
> sort(x)
> ans =
>
> 1.1987 3.0540 3.7587 5.8433
>
>>> sort(y)
> ans =
>
> 0.43359 0.76316 0.82807 1.76442
>
>>> hist(x,y)
Can I assume that you were intending to sort x and y before passing
them to hist? Because you didn't. You displayed them sorted, but you
did not store the sorted versions anywhere.
sort(x) displays the sorted version of x. it was actually stored in
the temporary variable ans, but you didn't actually change x or y.
if you want them sorted before the hist you need to do:
>> x = sort(x)
>> y = sort(y)
>> hist(x,y)
OR
hist(sort(x),sort(y))
Nick J.