Output the header of an imported ASCII file to a text objectIt is possible in Origin to output the header of an imported ASCII file to a
text object. All you need to do is place a text object named header on the
window (graph or worksheet) into which you are importing the ASCII file. The
header of the imported ASCII file will automatically be written into the text
object's Text Control dialog box.
To accomplish this you click once on the Text tool on the Tools toolbar and
then once on the window into which you are importing the text file. Close the
Text Control dialog box of the text object, right click on the text object to
open the Label Control dialog box and then enter header for the Object Name.
When you import the ASCII file into the window containing the text object named
header the imported file's header will automatically be written to the text
object.
If you wish to import the data into a worksheet, plot the imported data to a
graph window, and then have the label displayed in the graph window the task
becomes a bit more involved but can still be accomplished. Open a new
worksheet, set the ASCII Import options as desired, and create the text object
named header as described above except uncheck the Visible check box in the
Label Control dialog box. Next, select Tools:Worksheet Script, check the
Import checkbox and enter the script %Z=header.text$; into the large edit
box. Then select File:Save Template As and save the worksheet as a template
giving it a unique name.
Finally, create a graph window and place a second unnamed text object on it
where you want the header information to be displayed. Enter %Z in place of
enter text here. Close the Text Control dialog box and open the Label Control
dialog box by right clicking on the text object. Check the Link to Variables
check box and then save the graph window as a template with a unique name.
Once this has all been setup select File:New:Worksheet and open the worksheet
template created above. Import your text file as normal. Select the column or
columns you wish to plot and then select Plot:Template and open the graph
template that you created above. The data will be plotted and the header of
the file that was imported into the worksheet will be displayed in the text
object on the new graph window.
If you wish to display the different fields of the header in separate text
objects on the graph window you must follow a similar procedure for each
field/text object pair using a different % variable for each text object. You
will need to parse the header.text property in the Worksheet Script window and
assign the individual fields of the header to the individual % variables.