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
 Reorder for Curves, and some follow up issues
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Frank_H

Germany
Posts

Posted - 12/08/2005 :  6:47:20 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5 SR5
Operating System: Win XP

When using Reorder for Curves (it inherits it from vectorbase), only the y-dataset is reordered, the x is untouched. Then I end up with wrong combinations of x/y. Any suggestions to avoid this?

Perhaps there's also a simpler way to do what I am trying at the moment: I am using Reorder to reverse (mirror) a Curve. Is there a more direct way to do this? It's necessary as some of my data has monotonic falling x, and many of the analysis functions don't like that but expect monotonic rising x.

I don't like to use sort as I know, that my data is monotonic, and therefore a sort algorithm is really an overkill.

I could use a 1xN matrix and Flip. But then I have to access the x-data. Is there a more elegant way to do that beside extracting the name of the x-dataset with HasX and then construct the dataset with this name? I am missing any direct access to the x-Dataset of Curves!

easwar

USA
1965 Posts

Posted - 12/09/2005 :  09:54:26 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

If your curve is derived from datasets in a worksheet, then easiest is to use the Sort() method in curvebase class.

Say you have your X, Y data in columns 1 and 2 of the active worksheet and your X is in descending order and you want to flip so that X becomes asending order and Y is properly arranged as well. You can then use code such as:


void sort_curve()
{
Worksheet wks = Project.ActiveLayer();
Curve crv(wks, 0, 1);
crv.Sort();
}



The key is to use the correct Curve constructor. Note that some curve constructors (such as creating curve using dataset name) make a copy and then in that case original curve does not get changed.

Easwar
OriginLab

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