Sort similar data into columns

I have a data set something liek this:
1 2 3 4 5
3 4 5
2 3 4 5
2 5
What I would like to be able to do is find a simple way of putting all the similar values into 1 column, like the following:
1 2 3 4 5
0 0 3 4 5
0 2 3 4 5
0 2 0 0 5
In my code I am not actually trying to match exact numbers, I am trying to put in columns numbers that are a few decimal places apart, so numbers like 5.1, 5.2 and 5.3 would be in a single column. Anyone know an easy way to do this?

LVStudent wrote:
If I have a 2d array where each row contains the values of peaks positions for a particular graph, then the max width of the array is the length of the array which contains the most peaks. As for the height, I have 360 graphs, so their are 360 rows. Basically I have 360 graphs, where each graph represents the acoustic reflection of an object at 1 degree increments. What I am trying to do is track the changes of specific peaks, however their position moves around a bit so I need a way of lining these peaks up again so I can do a useful analysis. So basically what I do is use the labview peak extractor on each signal, and store the peak positions for each angle in a 2d array. Now I just want to line the data up. For example peak 1 might start at bin 5, then in the next graph jump to bin 5.1 and so on. Peak 2 might start at bin 12 then might jump to bin 12.1, then 12.2. So then I should have something like follows.
5.1  12
5.2  12.1
5.3  12.2
However when I have data like this:
1 2 5.1 7     12
0 0 5.2 12.1
0 0 5.3 8     12.2
I am finding it diffult to work out a way to do this.I havent really got any code written for this either that you might be able to lookover, because I dontreally know where to start.
The bit highlighted in red is the assumption you have made that is wrong. If the peaks are at different points you have a problem...
What you need to do is create a mega array of all the data points and find out how wide that would be:
e.g
1,2,4
1,2,4.5
these would still combine to make an array of 3 columns as all of the columns have the same data values.
1,2,3
1,2,4
these would combine to make an array of 4 columns (3 in IT speak and if indexing). The columns would be 1,2,3,4
If you have too much data to add together into 1 mega array and get the overall width first, the ther are other ways of doing it, I'm just pointing you at the simplest to implement. The other ways require more thought and debugging. (Think outside the box once you can see the problem).
James

Similar Messages

  • Transform data into columns

    hello
    i would like to transform rows into columns and need your help
    i have
    table orders
    where we have two columns
    orderid,orderdate
    orderid     order_date
    1234     9/10/2009
    4555     10/1/2009i have order_codes
    have 3 columns
    orderid
    desc
    value
    data for order _codes
    orderid     desc     value
    1234     ch_code1     5789
    1234     ch_date     10/20/2009
    1234     ch_miscval     678.9
    1234     ch_charge     765
    4555     ch_code1     9999
    4555     ch_date     10/0/2009
    4555     ch_miscval     78.9now
    i need to transform data like this
    orderid ==     ch_code1      ==ch_date ==     ch_miscval ==     ch_charge ==     order_date
    1234 ==     5789 ==     10/20/200  ==    678.9 ==     765      == 9/10/2009
    4555 ==     9999 ==     10/1/2009      == 78.9 ==     ---      == 10/1/2009any help is appreciated
    thank you
    Edited by: vg on Nov 2, 2010 9:47 AM

    try this. Hope this helps
    /* Formatted on 2010/11/02 13:29 (Formatter Plus v4.8.8) */
    WITH order_desc AS
         (SELECT 1234 orderid, 'ch_code1' descp, '5789' VALUE
            FROM DUAL
          UNION ALL
          SELECT 1234, 'ch_date', '10/20/2009'
            FROM DUAL
          UNION ALL
          SELECT 1234, 'ch_miscval', '678.9'
            FROM DUAL
          UNION ALL
          SELECT 1234, 'ch_charge', '765'
            FROM DUAL
          UNION ALL
          SELECT 4555, 'ch_code1', '9999'
            FROM DUAL
          UNION ALL
          SELECT 4555, 'ch_date', '10/0/2009'
            FROM DUAL
          UNION ALL
          SELECT 4555, 'ch_miscval', '78.9'
            FROM DUAL),
         order_t AS
         (SELECT 1234 orderid, SYSDATE order_date
            FROM DUAL
          UNION ALL
          SELECT 4555, SYSDATE
            FROM DUAL)
    SELECT   a.orderid, MAX (DECODE (descp, 'ch_code1', VALUE, NULL)) ch_code1,
             MAX (DECODE (descp, 'ch_date', VALUE, NULL)) ch_date,
             MAX (DECODE (descp, 'ch_miscval', VALUE, NULL)) ch_miscval,
             MAX (DECODE (descp, 'ch_charge', VALUE, NULL)) ch_charge,
             MAX (DECODE (descp, 'order_date', VALUE, NULL)) order_date
        FROM order_desc a, order_t b
       WHERE a.orderid = b.orderid
    GROUP BY a.orderid
    Output
       ORDERID CH_CODE1   CH_DATE    CH_MISCVAL CH_CHARGE  ORDER_DATE
          1234 5789       10/20/2009 678.9      765                 
          4555 9999       10/0/2009  78.9                            Edited by: new learner on Nov 2, 2010 10:30 AM

  • Sorting by date in columns cross tab report.

    Hi all,
    I am working on a cross tab report in BI Publisher in which columns are generated dynamically in a pivot table depicting months as Jan 09 , Feb 09.... but data type is char.When displayed in pdf, columns are generated sorted alphabetically.
    How can I have them sorted by date in final pdf?
    or
    How can I stop the columns being sorted in pivot table at template level?
    Thanks.
    Edited by: user9061488 on Jul 21, 2010 1:13 AM

    You need to get a extra column in the query just for sorting purpose, which will have month number in it or YYYYMMDD. format, so that , it can be used in only for sorting.
    with JAN 09, FEB 09 , we can do it, but it will be little complex

  • How do I put and sort string data into an array?

    I have a txt file that has the following sample data:
    Sample.txt----
    Jones Bill 12,500 Salesperson
    Adams Frank 34,980 Manager
    Adams John 23,000 Salesperson
    Thompson Joe 59,500 Trainee
    I need to incorporate each line of data into an individual array element, while using a user-defined method
    (ex. setAllValues(String last, String first, String salary, String job)
    How do I loop the data into the array to be displayed and what is the best way to do sorts on this sample data. Any code or clues would be super helpful.
    Sanctos

    If you set up an array of Strings you can use the java.util.Arrays.sort() method to sort it. If you need to sort arbitrary Objects (i.e. your 3 strings as a whole entity) your 3-way object will have to either implement Comparable or you could write a Comparitor class to do the ordering. Not much to it, though.
    Dom.

  • Show row data into columns

    Hi guys
    i have data coming in multiple rows and want to show same data in columns like multiple colours per product. colour are fixed in numbers i.e only three colours are there per product not more than that..
    sample data is like this
    id product_name colour
    101 A red
    101 A black
    101 A Green
    result required:-
    id product_name colour1 colour2 colour3
    101 A red black green
    thanks & Regards

    Hi,
    That's called a Pivot.  In Oracle 8.1 and higher, you can use ROW_NUMBER, CASE, and an aggregate function, such as MIN for pivoting. (Starting in Oracle 11, there's SELECT ... PIVOT.)
    You didn't post CREATE TABLE and INSERT statements for your table, so I'll use scott.emp to illustrate:
    WITH   got_r_num   AS
        SELECT  deptno
        ,       job
        ,       ename
        ,       ROW_NUMBER () OVER ( PARTITION BY  deptno
                                     ,             job
                                     ORDER BY      ename
                                    )  AS r_num
        FROM    scott.emp
    SELECT    deptno
    ,         job
    ,         MIN (CASE WHEN r_num = 1 THEN ename END)   AS ename_1
    ,         MIN (CASE WHEN r_num = 2 THEN ename END)   AS ename_2
    ,         MIN (CASE WHEN r_num = 3 THEN ename END)   AS ename_3
    FROM      got_r_num
    GROUP BY  deptno
    ,         job
    ORDER BY  deptno
    ,         job
    Output:
        DEPTNO JOB       ENAME_1    ENAME_2    ENAME_3
            10 CLERK     MILLER
            10 MANAGER   CLARK
            10 PRESIDENT KING
            20 ANALYST   FORD       SCOTT
            20 CLERK     ADAMS      SMITH
            20 MANAGER   JONES
            30 CLERK     JAMES
            30 MANAGER   BLAKE
            30 SALESMAN  ALLEN      MARTIN     TURNER
    If you do happen to have more than 3 items, the query still works, but only the first 3 are shown.  (In deptno=10, there is a 4th SALESMAN named WARD.)

  • Loading data into column of a table

    db11gxe , apex4.0 , firefox 24 ,
    hi all ,
    i have data in a text file or csv or any text format , and i want to insert the data in it into a column in a table in my schema ?
    can i do that ?

    This is your best option
    - Process Type Plugin - EXCEL2COLLECTIONS
    I've configured it for use in 3.x, so you shouldn't have a problem in 4.0

  • How to convert row data into columns without using pivot table?

    Hello guys
    I have a report that has several columns about sales call type and call counts
    It looks like this:
    Calls Type Call Counts
    Missed 200
    Handled 3000000
    Rejected 40000
    Dropped 50000
    Now I wanna create a report that look like this:
    Missed call counts Handled Call counts Rejected Counts Drop counts Other Columns
    200 300000000 40000 50000 Data
    So that I can perform other calculations on the difference and comparison of handled calls counts vs other call counts..
    I know pivot table view can make the report look like in such way, but they cant do further calculations on that..
    So I need to create new solid columns that capture call counts based on call types..
    How would I be able to do that on Answers? I don't have access to the RPD, so is it possible to do it sololy on answers? Or should I just ask ETL support on this?
    Any pointers will be deeply appreciated!
    Thank you

    Thanks MMA
    I followed your guidance and I was able to create a few new columns of call missed count, call handled counts and call abandoned counts.. Then I create new columns of ave missed counts, ave handled counts and so forth..
    Then I went to the pivot view, I realized there is a small problem.. Basically the report still includes the column "call types" which has 3 different types of call "miss, abandon and handled". When I exclude this column in my report, the rest of the measures will return wrong values. When I include this column in the report, it shows duplicate values by 3 rows. It looks like this:
    Queue name Call types Call handled Call missed Call abondoned
    A Miss 8 10 15
    A Handled 8 10 15
    A Abandoned 8 10 15
    in pivot table view, if I move call type to column area, the resulted measures will become 8X3, 10X3 and 15X3
    So is there a way to eliminate duplicate rows or let the system know not to mulitply by 3?
    Or is this as far as presentation service can go in terms of this? Or should I advice to provide better data from the back end?
    Please let me know, thanks

  • Write multiple devices data into columns

    Hi, I have a problem in writing data from 2 devices that i currently have (for pressure and temperature). I wanted it to be written in 2 coloums, one for temperature and one for pressure for each data produced. What i currently have is that the data written in rows. Please help me on this.
    Also, i put the time stamp, but the time only come out on the data as hh/mm/ss. would it possible to produce the time as in the graph, which is written as hh/mm/ssssss (in microsecond)
    I have attached my labview program, and also the current save file that i get, and also the required format that i really want.
    Thanks
    Solved!
    Go to Solution.
    Attachments:
    Meor_Monitoring.vi ‏76 KB
    50kW_1_2Measurement.txt ‏8 KB
    Data Format.rtf ‏1 KB

    Hi That wasa working well. However, The other problem arise which:
    1) 1Sample100hz: it writes all the time the data taken
    2) however, if i asked for 10 samples or more, only one time stamp created for the whole sample. The problem is that i need to produce each measurement with each time sample. would it possible to do this in labview?
    Attachments:
    1Sample100hz.txt ‏13 KB
    10sample100hz.txt ‏25 KB
    Meor_Monitoring.vi ‏76 KB

  • Convert table row data into column - 8i

    hello all,
    i have a table with the following data
    Machine Time
    MAC1 - 1
    MAC2 - 2
    MAC3 - 3
    MAC4 - 4
    MAC5 - 5
    and want to have a query as only for the mac1, mac2 and mac3
    MAC1 MAC2 MAC3
    1 2 3
    how to acheived this...i am on 8i thanks in adv.
    KK

    SELECT SUM(DECODE(MACHINE,'MAC1',TIME)) "MAC1",
    SUM(DECODE(MACHINE,'MAC2',TIME)) "MAC2" ,
    SUM(DECODE(MACHINE,'MAC3',TIME)) "MAC3" FROM TABLENAME

  • Inserting data into a column from 2 different tables

    Hi,
    I need to insert data into a table using 2 other tables. The tables that contain data have identical column names.
    Is using a UNION statement the only option?
    Also, if I need to insert data into columns from only one of the either tables, how do i do it?
    Thanks.

    For future reference, "doesn't seem to work" is a rather generic description... Posting the particular error message will be quite helpful, though I'm reasonably confident that I know the particular problem here.
    First, if only for sanity, you probably want to explicitly list the columns of the destination table in your INSERT statement.
    Second, it doesn't make sense to have DISTINCT clauses in queries that are UNION-ed together. A UNION has to do a sort to remove duplicates already.
    Third, the two queries you are UNIONing together have to return the same number of columns, with the same names, in the same order.
    You probably want something like
    INSERT INTO new_table( col1, col2, col3, col4, col5 )
      SELECT 'ABC'  col1,
             a.colA col2,
             a.colB col3,
             a.colC col4
             a.colD col5
        FROM table1 a
      UNION
      SELECT 'ABC'  col1,
             b.colA col2,
             b.colB col3,
             b.colC col4
             NULL   col5
        FROM table2 bJustin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How to put 58 columns of data into an array in one shot?

    I have a set of data with 58 columns and 5000 rows. However, I need to find offset for all the elements in this 5000x58 set of data. Is there an easier way to put all the data (offset) into an array in one shot other than using build array function? This is because if I use the build array function, I will need to separate all the data into 58 columns by indexing them. This is too time consuming.
    Thanks for the suggestion! Have a good day!

    VanessaWen wrote:
    I have a set of data with 58 columns and 5000 rows. However, I need to find offset for all the elements in this 5000x58 set of data. Is there an easier way to put all the data (offset) into an array in one shot other than using build array function? This is because if I use the build array function, I will need to separate all the data into 58 columns by indexing them. This is too time consuming.
    You need to explain in much more detail, because your problem is not clear.
    Is this a 2D array with 58 columns and 5000 rows?
    What is your definition of "offset"?
    Where does the offset value come from?
    Is "offset" it the same for each row (or column) or does it depend on the data?
    What is the definition of "one shot"?
    Why would you need to seperate all the data into columns in order to use build array?
    It it "too time consuming" to write the program or is the execution slower than expected?
    Is the final output a 1D or 2D array or something else?
    Please attach a VI containing a small 2D array diagram constant with typical data, then show us what kind of output you would expect after applying the described operation.
    LabVIEW Champion . Do more with less code and in less time .

  • How to convert data from rows into columns

    Hi,
    I have a sql table and the data looks like this
    GLYEAR GLMN01 GLMN02 GLMN03 GLMN04
    2007 -109712.40 6909.15 4758.72 56.88
    2007 -13411.32 19132.9 -5585.07 4362.64
    Where GLyear reprsents Year and GLMN01 is February, GLMN02 is March and so on,
    Now i want my output to be something like this which i want to insert into another table
    GLYear GLMonth GLAmount
    2007 February -109712.40
    2007 March 6909.15
    2007 April 56.88
    My new table has 3 columns, GLYear,GLMonth,GLAmount.
    Can someone please help me with the select statement on how to do this, i can work with the inserts.
    Thanks.

    I want you to check these form tread they have the same discussion as you.  They will definitely solve your problem
    http://blog.jontav.com/post/8344518585/convert-rows-to-columns-columns-to-rows-in-sql-server
    http://dba.stackexchange.com/questions/19057/convert-rows-to-columns-using-pivot-in-sql-server-when-columns-are-string-data
    http://stackoverflow.com/questions/18612326/how-to-convert-multiple-row-data-into-column-data-in-sql-server
    I hope this helps you in solving your problem. 
    Please remember to click “Mark as Answer” on the post that has answered your question as it is very relevant to other community members dealing with same problem in seeking the right answer

  • Help  needed  in inserting  into column  of XML type

    i have requirement of inserting data into column of xml type
    eg
    cust product cost
    1 a 3
    1 b 7
    1 c 5
    now required result should
    <PROD-LIST>
    <a>3</a>
    <b>7</b>
    <c>5</c>
    </PROD-LIST>
    Please let me know how to achieve this , i was trying write function , it was working for one values ,but how to do if many values exist .

    Take a deep breath, then retype this putting in all the words and punctuation you missed out the first time until it makes sense.
    Your sample data, for example, could be better formatted using the [pre] and [/pre] tags to preserve formatting and put in a table format. Similarly with your output. Why are two of the numbers floating around freely in your xml but the 3rd isn't?

  • Splitting comma seperated column data into multiple rows

    Hi Gurus,
    Please help me for solving below scenario. I have multiple value in single column with comma seperated values and my requirement is load that data into multiple rows.
    Below is the example:
    Source Data:
    Product         Size                                 Stock
    ABC              X,XL,XXL,M,L,S                 1,2,3,4,5,6
    Target Data:
    Product         Size                                 Stock
    ABC              X                                     1
    ABC              XL                                   2
    ABC              XXL                                 3
    ABC              M                                    4
    ABC              L                                      5
    ABC             S                                        6
    Which transformation we need to use for getting this output?
    Thanks in advance !

    Hello,
    Do you need to do this tranformation through OWB mapping only? And can you please tell what type of source you are using? Is it a flat file or a table?
    Thanks

  • I have downloaded and installed the latest version of numbers on my mac. Everytime I save and then try to reopen that document, I receive a message telling me that I need a new version of numbers. Also, when I try to sort the date column, it sorts out of

    I have downloaded and installed the latest version of numbers on my mac. Everytime I save and then try to reopen that document, I receive a message telling me that I need a new version of numbers. Also, when I try to sort the date column, it sorts out of order. The last version sorted fine.

    Welcome to Apple Support Communities
    When you install the new iWork version, the old iWork version is kept, so it looks like you are opening your old version.
    To fix this, open a Finder window, choose Applications in the sidebar and drag the new Numbers version to the Dock, so you can access to it quickly. Open all documents from this version. I don't recommend you to delete the old Numbers version in case you need it.
    Respecting to the second question, you will get better answers in the Numbers for OS X forum

Maybe you are looking for

  • Error occured while converting the file . . . . . .

    While trying to import a music CD into iTunes, I get the following message: Error occured while converting the file "Handel: Messiah, HWV 56 - Sinfony". You do not have the privelege to make changes. The song in question is: Handel: Messiah, HWV 56 -

  • Creating menu bar in Photoshop

    I created a menu bar with individual buttons and hover buttons in photoshop. I want the background buttons positioned in a set place and to have the hover buttons work when I hover over each button. What's the best way to do this? I started with maki

  • Error in test connection: Connection refused to host: 172.22.100.77

    Hi, I'm trying to connect B1if to a SBO DB in a different server that dosen't have B1if instaled. I'm getting this error: XCE001 Nested exception: java.rmi.RemoteException: com.sap.b1i.xcellerator.XcelleratorException: XCE001 Nested exception: java.r

  • Deleted Request

    Hi Gurus, In info package --> sheduler ->initialization request for source>Here while iam deleting red request green request also automatically deleted.(only 2 requests 1 is green 1 is red) But those green request available in data target. Now what t

  • NTFS Cluster size is set at 4k instead of recommended 64k.

    We have found that our partition is not aligned and need to get some feedback on a few things. Here are our numbers: Starting partition offset = 32,256 Stripe Size = 128k (131,072) Cluster size = 4k (4096) We are experiencing high "Avg Queue length"