[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: warning: hist: bin values not sorted on input
From: |
Juan Pablo Carbajal |
Subject: |
Re: warning: hist: bin values not sorted on input |
Date: |
Tue, 8 Dec 2015 15:50:52 +0100 |
On Tue, Dec 8, 2015 at 2:53 PM, Nicholas Jankowski <address@hidden> wrote:
> 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.
>
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/help-octave
Johnatan, do no write personal emails. Keep the mailing list in CC.
If you just want to plot your values use
plot (x,y)
if you want to use bars to plot your data use
bars(x,y)
but X must be ascending.