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
 matching tricks
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ovince

Yugoslavia
Posts

Posted - 10/08/2006 :  07:23:42 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi all,

Thanks for earlyer replies.

Usualy, there are tricks in programming languages to easily solve some particular problem. I am sure that there is a trick in Origin C to solve this one.

Lets suppose we have 2 multi-column Worksheets and that the first 3 coulms of each of them are 3 different object ID's ie. uniq numbers of the objects. The picture would be illustrative I think:





According to IDs (IDa, IDb and IDc) in these 2 Worksheets it is obvious that 3 rows match (1,2,3 rows in the Worksheet 1 on the left match 2,3,5 rows in the Worksheet 2 on the right). How to extrat matching rows in the separate Worksheet?

It is solvable with 2 for loops and it works but in the case where I have about 500 000 or more rows it is very slow.

Is there some trick? Maybe some vector tric?

Thanks
Oliver

zachary_origin

China
Posts

Posted - 10/08/2006 :  11:53:45 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Oliver,

I do not think it is a trick in OriginC but a comman problem of algorithm.

You can first sort the two worksheet in ascending order by the sequence of IDa, IDb, IDc (or any other sequence, but same for the two worksheets), then compare the worksheets with two iterators to storing the current position (similar to the common used algorithm for merging two sorted lists. here is a link about list merging http://www.maths.abdn.ac.uk/~igc/tch/mx4002/notes/node40.html ). This may shorten the time when the worksheets have a large amount of rows.

Zachary
OriginLab Technical Services.
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