Chapter 2. Importing ASCII data

To get started, run Scigraphica by typing "scigraphica" in some terminal window or - if you have already started Scigraphica - click the "New" button (i.e. "create new project") in the button bar of the main window.

Then double-click the "Data1" icon in the "Worksheets" canvas to open the worksheet. Take a closer look at the worksheet: the upper left worksheet cell (i.e. cell A0) is highlighted by default. This is important because SciGraphica takes the highlighted cell as the upper left corner of the array of numbers that is imported from the ASCII file. To import the file "spectrum.dat", click the cell using the right mouse button. From the appearing pop-up menu, choose file --> import. Use the file open dialog to import the spectrum.dat file that came along with this tutorial.

Upon clicking the "OK" button of the "file open" dialog, the dialog shown in Figure 2-1 opens.

Figure 2-1. The ASCII import options dialog.

The dialog is divided into four frames. The "File structure" frame contains some general settings concerning the data structure of the file. In our case, we leave the "Read file as" dropdown list untouched. From the "Delimiter" dropdown list, we choose tab as delimiter because the spectrum.dat file was generated with tabs as delimiters between the numbers of a line.

We also leave the "Read lines" frame untouched because we want to read the entire file from the first to the last line. Nevertheless it is helpful to keep in mind that SciGraphica is able to read only a defined part of a file if the user wants to do so.

In the "Worksheet options" frame, we check both entries because we want to have the columns renamed according to the first line of the ASCII file and because we want to have the worksheet renamed to the data file name.

Clicking the "Import" button reads the contents of the file and puts them as numbers into the worksheet cells (cf. Figure 2-2).

Figure 2-2. Worksheet Data1 after import of the spectrum.dat file. Note that the worksheet is renamed to the filename and that the columns have new labels.