Author |
Topic  |
|
ovince
Yugoslavia
Posts |
Posted - 10/08/2006 : 07:23:42 AM
|
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
|
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. |
 |
|
|
Topic  |
|
|
|