comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Sorting a matrix
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Sorting a matrix [message #83434 is a reply to message #83346] Thu, 07 March 2013 05:32 Go to previous messageGo to previous message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
Den onsdagen den 6:e mars 2013 kl. 06:22:01 UTC+1 skrev Jeremy Bailin:
>> Oh, this looks pretty clever. I think I understand the idea but I'll have to digest the details. If I'm right, you find out for each column how many different values there are and then multiply the index for that column with the proper number to avoid overlap with the other column indices when adding.
>
> Yes, that's exactly right!

OK, good. But I have problems with the ord() function. When called with an array of only zeros, the call to histogram() does not work:

HISTOGRAM: Expression must be an array in this context: UNIQVALUES.
% Execution halted at: ORD 14

Where line 14 is

h = histogram(uniqvalues,bin=1,min=0,reverse=ri)

The reason is that when there is only one value, uniqvalues has only one element and is therefore turned into is a scalar.

The call to histogram works if I chance it to

h = histogram([uniqvalues],bin=1,min=0,reverse=ri)

Could this have bad consequences in other cases or is this what I should do? You described the ord() code you gave as a stub. Does this mean there is a more complete version that maybe checks for this problem (and other problems as well)?
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: where, or, and loops. There has to be a better way.
Next Topic: SPAWN with AWK

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Oct 12 13:37:27 PDT 2025

Total time taken to generate the page: 1.28249 seconds