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
 Problem with vectorbase::FindDuplicate
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

tumstudent

Germany
4 Posts

Posted - 03/01/2011 :  3:53:30 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin):
Operating System: Windows 7

Hi everybody,

I have a problem with Origin Pro 8.5G SR1 when programming in OriginC. The code is the following:


void wksDelDoubleEntries(string wksname, string colname)
{
Worksheet wks(wksname);
	
string ds0name = wksname+"_"+colname;
Dataset ds0(ds0name);
vector v0(ds0);
	
vector<int> vnMapIndices;
vector<uint> vnR1s;
int nRet = v0.FindDuplicates(vnMapIndices, vnR1s);
 
if(vnR1s.GetSize()>1)
	{
		for(int i=0; i<vnR1s.GetSize(); i++)
		{
			out_int("Vector entry", vnR1s[i]);
		}
	}    	
}


Now when trying to compile this I get an error like

07AddAnalysis.c
Linking...
[folder...]\110302 Origin Analysis\07ADDANALYSIS.C(750) :Error, external DLL cannot find function FindDuplicates
Linking Failed!

can anyone please help?

Many thanks in advance,
Max

Penn

China
644 Posts

Posted - 03/02/2011 :  01:00:28 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Max,

The method FindDuplicates only works for string type vector, For numeric type vector, you need to convert the vector to string type vector first. You can use the function convert_double_vector_to_string_vector to make the conversion in your case here.

Penn
Go to Top of Page

tumstudent

Germany
4 Posts

Posted - 03/02/2011 :  04:45:27 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Many thanks, the error is gone now but somehow no duplicates are recognized (even though there definitely is some). Solved the problem in a less elegant way now:

void wksDelDoubleEntries(string wksname, string colname)
{
	Worksheet wks(wksname);
	
	string ds0name = wksname+"_"+colname;
	Dataset ds0(ds0name);
	vector v0(ds0);
	
	for(int i=ds0.GetSize()-1; i>0; i--)
	{
		if(ds0[i]==ds0[i-1])
		{
			wks.DeleteRow(i);
			printf("Deleted Row in "+wksname);
		}
	}
	
}
Go to Top of Page

darronwolflx

USA
2 Posts

Posted - 03/02/2011 :  05:29:14 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The whole thing is just mind boggling! Windows 7 is interesting at the same time complicated as well. I nearly popped my eyes out trying to find a solution. Thanks for all the help, I'll definitely try the work on the code and check the links too.
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