Click or drag to resize

Changing the structure of a worksheet

Previous section: Importing ASCII data

This topic contains the following sections:


Transposing a worksheet

Sometimes it is necessary to exchange data rows and data columns. This operation is called transposing a table. To do it, make the worksheet you want to transpose the active document and then choose Worksheet→Restructure Worksheet data→Transpose from the main menu. A dialog opens (see figure below).

FDADB0208290E6CBA531212161BD248C

You can specify the number of data columns to convert to property columns, and you can specify the number of property columns that will be converted to data columns. If you want to do only a simple transpose of all data columns, set both numbers to zero.

The figure below shows a worksheet before (left side) and after transposing (right side), choosing one data column to convert into a property column and two property columns to convert into data columns. Note that in this worksheet all data columns and property columns of type TextColumn.

287BFF7B6229CFF1E16BBCACF21B6118

The one data column that is converted to a property column is marked green. The two property columns which become data columns are marked with blue and purple. The other data rows (I have marked only column 1 and 2 become data rows in the transposed worksheet.

Please note that transposing a worksheet works best if all columns are of the same type. Otherwise some loss of data can not be avoided.

Decompose a table with a cycling independent variable

Consider the following worksheet:

51E626A668CD6DC280E60F4EA92E09CA

This data could have been produced by a measurement device, varying the measurement frequency (data column 0), and the temperature (column 1). The measured values are the real and imaginary part of the modulus in columns 2 and 3.

Obviously, in the given form, if you try to plot the data (Modulus.Re) versus frequency, you will get a scrambled result:

D4FB4691D1D2EACDE7FA5778D881480F

This is because the frequency is repeated three times: (1, 10, 100, 1, 100, 100 and so on). I call the frequency here ‘cycling independent variable’ because it cycles between a set of values (1, 10, 100).

What you really need are separate columns for the modulus, one for each temperature (if you want to plot modulus versus frequency), or one for each frequency (if you want to plot modulus versus temperature).

If you have separate columns of the modulus for each temperature, you can plot them much more nicely that in the example above. Furthermore, you can show the temperatures that belong to each column in the legend:

61BD6B063E0DE43CCCA7FA4ECE5A855D

This kind of restructuring can be achieved with the command:

Worksheet→Restructure Worksheet data→Decompose table with cycling indep. Var'''

from the main menu.

Before you issue this command, select all columns that you want to have in the new worksheet, including the cycling variable (here: Frequency) and the second independent variable (here: Temperature).

For the next examples, I had always selected all four datacolumns in the original worksheet.

A dialog appears:

CF5BFABEFB0D24A7E3967B7B76E8144E

Make sure that the column with the cycling variable is selected in the first combo box. In the list box labeled ‘Columns to average over one repeat period’ you should select the second independent variable, which here is the column ‘Temperature’. The next choice (‘Destination output’) is about how to group the remaining columns in the destination worksheet. ‘Destination X’ let you choose the cycling variable as the new x-column (here: if you want to plot modulus versus frequency), or the first averaged column (here: if you want to plot modulus versus temperature). The remaining options concern the sorting of the columns and rows in the destination worksheet and should be self-explanatory.

With the data above, I chose ‘GroupOneColumn’ for destination output and ‘CyclingVariable’ for Destination X (see figure below).

C9532F1588D0F4B1A675340B957C421F

The resulting worksheet look like this:

3DF2573DD8057A3011F1273F1899EFE4

As you can see, ‘Frequency’ is the X-column of the resulting worksheet, and this column no longer contains repeated values. The temperature has become a property of the other columns; it is now a property column. By the option ‘GroupOneColumn’ first the three ‘Modulus.Re’ columns appear in the new worksheet, and then the three ‘Modulus.Im’ columns, one column for each temperature (to be exactly: for each cycle of the frequency).

In contrast to that, consider the following options:

695431ED3087DE3959FB49B4C12800AC

Here I have chosen ‘GroupAllColumns’ for destination output and ‘FirstAveragedColumn’ for Destination X. The outcome of this options is:

0E4901DD95532E8B52A44F4E2456E5FC

As you can see, now ‘Temperature’ is the x-column of the resulting worksheet. The frequency has become a property of the other columns, since it is now a property column. By the option ‘GroupAllColumn’ all other columns (Modulus.Re and Modulus.Im) are repeated for the first frequency (1), then for the next frequency (10), and finally for the last frequency (100).

Convert X-Y-V columns to a matrix

Consider the following worksheet from the previous chapter:

1DB3D9952DE94BA0ADB0B490ACD63510

Note that I here marked column 1 (‘Temperature’) as y-column (by using Column→Set column as Y from the main menu). Then I selected column ‘Frequency’ (x-column), column ‘Temperature’ (y-column) and column ‘Modulus.Re’ (V-column).

After using Worksheet→Restructure Worksheet data→Convert X-Y-V to matrix the following worksheet results:

F4DEB8301D15683A266AEBF66057DF8D

As you can see, the Modulus.Re values are arranged ‘matrix-like’ in columns 1, 2 and 3. The x-column is still column 0 (‘Frequency’). And the former y-column ‘Temperature’ has become a property column with the same name. You can use such a ‘matrix-like’ worksheet for instance to make a density plot.


Next section: Worksheet Notes