Author |
Topic  |
|
newuser_ca
70 Posts |
Posted - 09/04/2012 : 2:28:08 PM
|
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
|
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 |
 |
|
newuser_ca
70 Posts |
Posted - 09/05/2012 : 3:57:24 PM
|
Hi Penn,
Thanks a lot. |
 |
|
|
Topic  |
|
|
|