Re: What? You can't histogram a string array? [message #51545 is a reply to message #51544] |
Tue, 28 November 2006 10:12   |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Tue, 28 Nov 2006 09:52:06 -0800, Braedley wrote:
>
> Braedley wrote:
>> JD, a small nitpick: ind_int_sort will occasionally take the index from
>> [a, b], and not from just a. This can quickly lead to out of bounds
>> conditions if the user doesn't want to index [a, b], but just wants to
>> index a. In my case, a is a column from a 2D string array, where b is
>> just a 1D string array. I think a where statement is all that is
>> needed to fix this (I know, it'll slow it down for large sets).
>>
>> Braedley
>
> Actually, the fix was much easier than previously thought. Instead of
> return, srt[wh]
> use
> return, srt[wh]<srt[wh+1]
>
> I haven't done any tests, but it shouldn't take much longer for sparse
> or small sets.
That is a clever fix, but if the ordering of elements from a and b is
random, and if you have a repeated set in a match a repeated set in b, and
their interleaved sorted order is random, you'll get back a random number
of the matching repeats (not 1, as was intended).
See my other post though, and let me know your findings w.r.t. SORT.
Thanks,
JD
|
|
|