T O P I C R E V I E W |
eyP |
Posted - 11/30/2006 : 08:40:16 AM Origin Version (Select Help-->About Origin): 7G SR4 Operating System: Windows XP
I want to set the number of columns with LabTalk. I use the ascimport function but the radio button remains too unknown. I get an error message "The file contains no ascii data". When I use the Ascimport.Partial function I get the same message. This was suggested in Forum task "Ask ascimport.numcolumns". It's possible to solve this with Origin C?
If I use a wks template where the option is set correctly (2 columns), it is set back to unknown if I use: ascimport.GetSettings(); ascimport.WriteSettings(); //To set the import file name in between Is there a Origin C statement to set the radio button back to two columns?
Best regards
Edited by - eyP on 11/30/2006 09:04:08 AM |
3 L A T E S T R E P L I E S (Newest First) |
Mike Buess |
Posted - 12/05/2006 : 2:56:12 PM Under many circumstances ASCII Import assigns the file header to the string variable %Z. The following script imports all four data columns to the active worksheet and creates a text label for the header.
ascimport.GetSettings(); ascimport.Delimited=1; ascimport.Delimiter=3; // delimiter=space ascimport.Partial=0; ascimport.HeaderLines=0; ascimport.SubHeaderLines=0; ascimport.AutoSubHeaderLines=1; ascimport.RenameWks=0; ascimport.ApplyRange=0; ascimport.RenameCols=0; ascimport.Labels=0; ascimport.MaxLabels=0; ascimport.LeadingZeroes=0; ascimport.NonNumeric=1; ascimport.AutoColTypes=1; ascimport.TestLines=3; ascimport.WriteSettings(); ascimport.FileName$=%A; %Z=""; ascimport.import(); if( %Z!="" ) { ty -a %Z; // type header to script window label -s -n Header %Z; // type to text label Header.top=0; Header.left=400; // adjust to suit };
Mike Buess Origin WebRing Member |
eyP |
Posted - 12/05/2006 : 04:54:19 AM The data can be imported manually. The separator is ":" with two columns. The idea is to import the file header with this setting to collect specific values (wert1...wert3, 2 columns) and to look for the beginning of the measurement data. In a second import step the measurement data is imported (4 columns). There are two problems: The ASCII error message and the automatic 2 column import.
This is the data file:->
quote:
[DATEIKENNUNG] Kennlinie CX4G HP Messplatz
[Option1] Feld1:wert1 Feld2:wert2
[Option2] Feld1:wert1 Feld2:wert2 Feld3:wert3
[Messdaten]
[Eckdaten]
Ith I@10000 mW Slope U@16677mA Rs [mA] [mA] [W\A] [Ohm]
If [mA] Po [mW] Uf Imo [mA] 0.00 15.00 0.07 0.00 387.00 8.00 1.25 0.00 1068.00 14.00 1.30 0.00
This is the import routine:->
ascimport.GetSettings(); ascimport.Partial.C1=1; ascimport.Partial.C2=2; ascimport.Partial.R1=1; ascimport.Partial.R2=40; ascimport.Delimited=1; ascimport.Delimiter=4; ascimport.Character$=":"; ascimport.Width$=""; ascimport.HeaderLines=0; ascimport.SubHeaderLines=0; ascimport.AutoSubHeaderLines=0; ascimport.Mode=0; ascimport.NumColumns=2; ascimport.partial=0; ascimport.RenameWks=0; ascimport.ApplyRange=0; ascimport.RenameCols=0; ascimport.Labels=0; ascimport.MaxLabels=0; ascimport.LeadingZeroes=0; ascimport.NonNumeric=1; ascimport.FileName$=%A; //Import Dateiname ascimport.AutoColTypes=0; ascimport.TestLines=3;
ascimport.WriteSettings(); ascimport.import();
Edited by - eyP on 12/05/2006 05:09:33 AM |
zachary_origin |
Posted - 12/01/2006 : 08:07:10 AM Can the data be imported by manually operation from the menu? By default, if the number of columns is set as unknown all the columns will be imported. Maybe you need paste your LabTalk script and pieces of the data here so that we can get more information.
Zachary OriginLab Technical Services.
Edited by - zachary_origin on 12/01/2006 08:11:23 AM |