How can I separate a column data by odd/even rows?

Welcome to our Forums Technical Support Support Desk How can I separate a column data by odd/even rows?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #9634
    flemir
    Participant

      Dear all,

      Is there an easy way to extract the odd/even row from a column? For example, I usually have the Peak/Valley data, i.e., the odd row is the valley value, and the even row is the peak value. However, I constantly need to plot the peak value or the valley value. Now I am using excel to separate the peak and valley values into different columns, then paste into Datagraph. I am just wondering is there a better way to do the trick in Datagraph? That will save me a lot of time. Thanks all.

      #9635
      dgteam
      Moderator

        Sounds like you want something like this, where we made up some random data, then created a column that separates the odd and even values.

        EvenOdd1

        The Odd and Even numbers are created using an Expression column.  The expression uses the built-in row counter ‘#’ and you specify the number of rows.

        EvenOdd2

        Another expression column is used to pull the values using the column name followed by the index in parentheses.

        EvenOdd3

        You could also do it in one step, such as “Data(#*2-1)” and “Data(#*2)” and use a variable for the column length if that changes all the time.

        Does that help?

         

        #9636
        jordan
        Participant

          I guess I took the request another way. It sounded like for every data point, there were two values.

          The method I chose was to mask the data with a if statement that checks the reminder of a number divided by 2. This separates the peaks and troughs, and then you can plot them individually.

          Screen Shot 2022-09-12 at 11.12.29 AM

          #9637
          dgteam
          Moderator

            Jordan – Good suggestion!  Your approach has the benefit of maintaining the data in the same row, which could be helpful to verify everything is working correctly and keep the data tied to any other columns of data you may have.

            #9640
            flemir
            Participant

              That is exactly what I want, thank you so much!

              #9641
              flemir
              Participant

                Thank you Jordan, this is a fancy way to do the trick. Thank you very much.

              Viewing 6 posts - 1 through 6 (of 6 total)
              • You must be logged in to reply to this topic.

              Welcome to our Forums Technical Support Support Desk How can I separate a column data by odd/even rows?