Wednesday, May 14, 2008

Set Column Values in Origin

Most of the times, when importing data into OriginLab, I need to normalize the data by a certain value, or perform certain calculations over each column. When this normalization or calculation is the same for all columns (i.e. normalize the column by 10) it is a hassle to go over each column, right click on it, select "Set Values", and then type in the formula for that column. This is tedious when my columns have long times. There a much easier way of doing this by using the "Before Formula Scripts". I know that this functionality is available as of Origin 8.0. Here's how I am currently doing it:

  1. Select the first column by clicking on its title label
  2. Right click and invoke the "Set Values" dialog box
  3. Click on the little arrow to the bottom right (called "Show Scripts")
  4. In the "Before Formula Scripts" text box, type in the following
    // Get index of current column
    const nn = _ThisColNum;
    // Perform numerical operations on this column
    wcol(nn) /= 10;

  5. Click apply
  6. Select the formula and copy it (Ctrl + c)
  7. Now go to the next column by clicking on the Next Column button (or simply selecting another column)
  8. Paste the formula (Ctrl + v) and click apply
Voila!

I do this for all the columns. This process is very fast if you have a good handle on using the keyboard.

Cite as:
Saad, T. "Set Column Values in Origin". Weblog entry from Please Make A Note. http://pleasemakeanote.blogspot.com/2008/05/set-column-values-in-origin.html

2 comments:

  1. Excellent thanks for this, I really enjoyed this lesson.

    ReplyDelete
  2. This is perfect but I want to know what happens if in that formula I get something related to Cheap Viagra Online, because a friend of mine told me that and I was so confused.

    ReplyDelete