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?
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
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.
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 };