The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 How to sort a Vector and get indices?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Gutalin

5 Posts

Posted - 05/25/2010 :  05:18:45 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi all,
I have a problem with the sort-function.
I'd like to sort a double-type vector so as to get a new vector with values in ascending order and a second vector with indices of these values from the unsorted vector.

Thats exactly what the vector.sort-function is for, I guess, but I don't know how to create the indices-vector.

Could someone help me?

Thanks in advance!

Jurij

Penn

China
644 Posts

Posted - 05/25/2010 :  9:17:48 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Jurij,

Yes, there is a method named Sort in vectorbase class. This method can satisfy your requirement. This page has provided the prototype and examples on how to use it.

Penn
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000