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

newuser_ca

70 Posts

Posted - 09/04/2012 :  2:28:08 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro 8.6 in Win7

I am importing a csv file using AscImpReadFileStruct. I noticed that if I have a small set of data, function AscImpReadFileStruct is not working well.
I use the following codes to import.

int errCode = AscImpReadFileStruct(fileName, &ai);

The csv file is :
"Value","Word","Mnemonic","ID","Timestamp"
0.06941799819469452,W20630,"S2_Batt_Recharge_Ratio",F2,2456175.1316697453
0.07112599909305573,W20630,"S2_Batt_Recharge_Ratio",F2,2456175.1320490045
0.07277300208806992,W20630,"S2_Batt_Recharge_Ratio",F2,2456175.1322386344
0.07448100298643112,W20630,"S2_Batt_Recharge_Ratio",F2,2456175.132617882
0.07618899643421173,W20630,"S2_Batt_Recharge_Ratio",F2,2456175.132997141


The first line is the column information and the rest is the data.
If I have 5 lines of data, function AscImpReadFileStruct is working well.
However, if I have only 4 lines of data, I get error Code 3002.

How can I import the file properly?

Thanks.

Penn

China
644 Posts

Posted - 09/05/2012 :  01:28:06 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

It seems a bug in Origin 8.6. I have tried in the in-house build of next version (9.0), it works fine. For now, you can try the impcsv X-Function, such as

string strfile = GetOpenBox("*.csv");  // select the file
if(strfile.IsEmpty())
	return;

string strCMD = "impCSV fname:=\"" + strfile + "\" options.HeaderLines.SubHeaderLines:=1 options.HeaderLines.LongNames:=1";  // construct the LabTalk command
Worksheet wks;
wks.Create();
LT_execute(strCMD);  // execute the LabTalk command


Penn
Go to Top of Page

newuser_ca

70 Posts

Posted - 09/05/2012 :  3:57:24 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Penn,

Thanks a lot.
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