Identify peaks on graph using cursors

I have a piece of analysis software that is supposed to identify event shapes based on peaks in a histogram (attached, along with a sample data set). Following the advice of users in my last thread, I rewrote the program in what I hope is a much improved way. My first question as a LabVIEW newbie: please critique my code. Suggestions for improved style/readability are more than welcome.
Currently, the program automatically detects peaks in the histogram and fit them, which works fine. However, for more noisy data sets where peaks overlap or there may be many small peaks, it does not do as good a job as it does for the sample data provided. To that end, I would like to be able to have users specify peak locations, ideally by clicking on the graph. It would be relatively simple to have them input them numerically (something like this, for example: https://decibel.ni.com/content/docs/DOC-2238), but I would like to learn to user cursors at the same time if possible. So, my idea is this:
After plotting the raw histogram without a fit, users would be prompted to enter a variable number of peak locations by clicking on the graph, which would then be used to split the graph up into pieces containing a single peak and fit, just as is already done in the program. Basically I want to replace the Peak_Detector.vi with user input. I believe from reading around that the way to do it would be to use cursors, but I haven't been able to find an example showing me how to do it. A push in the right direction would be appreciated!
To run it, feed the input file the attached .csv and take the default values. If anything is unclear, let me know.

(disclaimer : I haven't looked at your VI).
One way to use the cursors would be to create one (in EDIT mode) and have it snap to plot 0.
It will therefore always be on your plot.
You can show the readout (Cursor Palette) if you like.
In the code, it's just a property of the graph.
You could respond to changes in cursor position and provide your own readout, if you like.
Provide a button (or menu item) to DO IT, and when the button is clicked, you remember the X and Y cursor value (read the properties) and use that Y value as your peak.
you could also look up some other value at that X location, if that does anything for you.

Similar Messages

  • XY graph datapoint display using cursor

    Hello to all, I am using XY graph to display amplitude v/s time. While running the vi, data is continuously plooted on graph till user stops the vi. I want to add a feature such that, while running the vi, when user click on the graph on particular position using cursor, it should display corresponding time value and amplitude value of that point. I mean value of Y-axis corresponding to X-axis not the cursor position. When using cursor position, it is ok with X-axis but it shows the position of cursor for Y-axis (as property says) , and I want datavalue of that point not y-axis position.
    I hope it is clear with question. Let me have some example...for y=x graph shown below, you can see for cursor x=4.4 and y=6.8, how to display corresponding datapoint which shoud be y=4.4
    Solved!
    Go to Solution.

    While creating (or even after you created), choose 'Snap to' Plot 0.
    Don't let it be 'Free Dragging'
    Example attached.
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.
    Attachments:
    Snap to Plot 0.vi ‏10 KB

  • Line using cursor in xy graph

    hi
    how i can draw line using cursor in xy graph
    Solved!
    Go to Solution.

    Hi bijal,
    Not sure what you are planning to do. But you could start with:
    Creating a XY graph. 
    Right click on the XY graph >> Visible Items>> Cursor Legend. 
    Right click on the cursor legend >> Create Cursor >> Free. Up to this step, you should able to create the cursor.
    To obtain the data from the cursor, go to your block diagram >> right click on the XY graph terminal at the block diagram >> Create >>  Property Node >> Active Cursor. This should create the property node for your XY graph. To change a selected property to write, right click on the active cursor >> Change to Read and it should be like below:
    Just input 0 to access the first cursor
    Expend it to access an additional properties >> on the second property, click on it >> Cursor >> Cursor Position >> Cursor X. 
    Expend the properties until you see as below:
    It Cursor.PosX and Cursor.PosY isn't changed to write, do change it to write by right clicking on Cursor.PosX >> Change to Write. Do the same for Cursor.PosY
    Up to point 6, you should be able to obtain data from the XY graph cursor.  
    Use those values to plot into the XY graph. I believe you'll need to find a way to plot XY graph by building an array of clusters. 
    Hope it helps
    Warmest regards,
    Lennard.C
    Learning new things everyday...

  • Labeling points on XY graph with numbers. Trying to use cursor names.

    I have found some example vis in the NI Developers Zone that label the points using Cursor Name attribute. I have some success, but results are not consistent. I need up to 100 labels...is there a limit to the number of cursors? Is there a way to initialize 100 cursors without using Cursor Legend? Sometimes the cursors do not appear or do not move...they don't seem to be consistent. Any other ideas to solve this problem? Would it be possible to show the number of the point when the cursor is moved to that point. I am using LabView 6.0. windows 2000.
    Thanks.
    Liz

    > Problem: When trying to change cursor position programatically using
    > attribute notes, the cursor position will not change.
    >
    > I found this in the knowledgeBase. Solution: Unlock the cursor.
    > Cursor position attributes are read-only when the cursor is locked.
    > Liz
    > Still looking for answer of a way to initialize 100 cursors with
    > Cursor legend.
    >
    If you want to do things programmatically, like set the cursor text to
    match the X or Y value of the point, read the value, format the string
    and write it to the name of the cursor.
    If you want to init 100 cursors interactively, you can popup on the edge
    of the cursor legend and show the index. The cursor legend is simply an
    array of clusters of cursor info. Set the index to 99 and type in a
    name, value or something else. This will allocate 100 cursors. I'm not
    sure if that is what you meant.
    Greg McKaskle

  • Waveform graph:move cursor automatically to know coordinate

    Good Day
    Can i know how to move cursor automatically in the waveform graph
    example: i have known Y =2 what is the value of  x is...
    which properties in property node should i use?
    attached also my vi (Coordinate of XY data using cursor)
    Best Regards
    Ahmad Tarmimi
    Solved!
    Go to Solution.
    Attachments:
    coordinate XY.vi ‏40 KB

    Good Day
    I was trying to program the cursor automatically but it does'nt seem working for me..
    Can you please advise me on this matter... 
    Attached also my study pupose vi
    Best Regards
    Ahamd Tarmimi
    Spoiler (Highlight to read)
    Attachments:
    cursor adjustment.vi ‏53 KB

  • I Want to graph useing MSGraph with array data

    Hi..
    I need to skill to graph using the msgraph with array data
    My forte version 2.0h
    E-MAIL ADDRESS : [email protected]
    TEL(C) : 02)273-3131(5233), 0331)40-8366(ÇöÀç ¿©±â ÀÖ½¿)
    PAGER : 015-959-9390
    HAND PHONE : 011-411-9395
    To unsubscribe, email '[email protected]' with
    'unsubscribe forte-users' as the body of the message.
    Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>

    This #pdfloc data is generated by RMSDK when user highlight (annotation) pdf and keep it in XML format in file system: E.g.
    <annotation y="-116" isvisible="False" x="-110" width="220" height="100">
            <dc:identifier>urn:uuid:DF061693-A668-49DF-A20B-DE243C463919</dc:identifier>
            <dc:date>2015-03-02T12:04:53Z</dc:date>
            <dc:creator>creator id</dc:creator>
            <dc:title>Page 4, 02-Mar-2015 5:34 pm</dc:title>
            <target>
                <fragment start="#pdfloc(7f54,3,37,0,0,0,0,1)" end="#pdfloc(7f54,3,37,3,1,0,1,1)">
                    <text>by Matt</text>
                </fragment>
            </target>
            <content>
                <dc:date>2015-03-02T12:04:53Z</dc:date>
                <text></text>
            </content>
    </annotation>

  • Is it possible to use cursors and zooming in the plotxy function that outputs pictures?

    I use the plot multi xy function in my vi that outputs a picture. And I wonder if it is possible to use cursors and zooming with this output picture?
    Thanks,
    Ogulcan Kaya

    Hi Ogulcan,
    it is, but not as straightforward as with standard graphs.
    As a starting point take a look at the example shipped with LV: Modified Smith Plot with Zooming.vi; you find it in picture examples.
    Good luck,
    Alberto

  • What's instance, ROWID and why we use cursor?

    Dear memebers,
    yesterday i have an interview there i faced the following questions.
    1. what is instance?
    2. what is ROWID?
    3. why we use cursor?
    i can give only the last one.
    i am waiting for your answer.
    thanks
    Regards:
    Muhammad Nadeem
    [email protected]

    HY
    Row Identifiers
    Each row in an Oracle database has a unique row identifier, or rowid, which is used internally by the Oracle database to access the row. A rowid is an 18-digit number that is represented as a base-64 number, and it contains the physical address of a row in an Oracle database. You can view the rowid value for rows in a table by specifying the ROWID column in the select list of a query. The query in the following example retrieves the ROWID and customer_id columns from the customers table:
    SELECT ROWID, customer_id
    FROM customers;
    Oracle instance:
    An Oracle instance is the combination of the background processes and
    memory structures. The instance must be started to access the data in the database. Every
    time an instance is started, a System Global Area (SGA) is allocated and Oracle
    background processes are started. Background processes perform functions on behalf of
    the invoking process. They consolidate functions that would otherwise be handled by
    multiple Oracle programs running for each user. The background processes perform
    input/output (I/O) and monitor other Oracle processes to provide increased parallelism
    for better performance and reliability.
    REGARDS

  • Generate report using CURSORS? - Simple question

    Folks,
    I'm a real newbie still with PL/SQL so please excuse my ignorance I have a simple report I need to generate. The following SQL statement gets me all my "header" records:
    SELECT OHA.ORDER_NUMBER, HEADER_ID, ATT11, ATT12, ATT16
    FROM XXXWD.WD_DUPS DUPS, OE_ORDER_HEADERS_ALL OHA
    WHERE OHA.ATTRIBUTE11 = DUPS.ATT11
    AND OHA.ATTRIBUTE12 = DUPS.ATT12
    AND OHA.ATTRIBUTE16 = DUPS.ATT16
    AND (OHA.FLOW_STATUS_CODE NOT IN ('CLOSED', 'CANCELLED'))
    AND (ATT11 <> 'WESTERN SERVICE')
    ORDER BY ATT11, ATT12, ATT16
    What I want to do now is have a second script that will display all my detail records. Something like:
    SELECT OLA.LINE_NUMBER, OLA.ORDERED_ITEM, OLA.FLOW_STATUS_CODE
    FROM OE.ORDER_LINES_ALL OLA
    WHERE OLA.HEADER_ID = OHA.HEADER_ID
    I expect I'd do this with two cursors, passing the value of my HEADER_ID to my second cursor. But when I've used cursors before, they primarily have been to import data, and manipulate data. But what if I just want to create a report using these?
    I essentially want to display my header information, and then any lines below that data (if there is any, there may be a header with no lines).
    Can I create a simple report like this with cursors? Any help with this would be IMMENSELY appreciated. I'm really under the gun... :)
    Thanks so much!
    Steve

    Here's one query that will give you everything:
    SELECT OHA.ORDER_NUMBER
          ,OHA.HEADER_ID
          ,DUPS.ATT11
          ,DUPS.ATT12
          ,DUPS.ATT16
          ,OLA.LINE_NUMBER
          ,OLA.ORDERED_ITEM
          ,OLA.FLOW_STATUS_CODE     
    FROM   XXXWD.WD_DUPS        DUPS
          ,OE_ORDER_HEADERS_ALL OHA
          ,OE.ORDER_LINES_ALL   OLA
    WHERE  OLA.HEADER_ID   = OHA.HEADER_ID
    AND    OHA.ATTRIBUTE11 = DUPS.ATT11
    AND    OHA.ATTRIBUTE12 = DUPS.ATT12
    AND    OHA.ATTRIBUTE16 = DUPS.ATT16
    AND    OHA.FLOW_STATUS_CODE NOT IN ('CLOSED', 'CANCELLED')
    AND    DUPS.ATT11 <> 'WESTERN SERVICE'
    ORDER  BY OHA.ORDER_NUMBER
             ,OLA.LINE_NUMBER
             ,DUPS.ATT11
             ,DUPS.ATT12
             ,DUPS.ATT16
    ;(correction in order by clause)
    Message was edited by:
    Eric H

  • To Use  Cursor or  TYPE table Index by PLS_integer

    Hi All,
    Let's see if I have table with no. of records 19,26,20,000.
    If I want to loop through all the records which will be a optimized way To Use Cursor or TYPE table Index by PLS_integer.
    Please guide.
    Thanks.

    What is it you want to do to/with the rows you're looping through?
    Ideally you want to avoid looping, as that's row by row (aka slow by slow) processing and it's expensive time-wise.
    If you're doing DML (insert/update/delete) then you're best off doing it in one sql statement, rather than looping.

  • How to pick max value from a column of a table using cursor and iteration

    Hello Everybody
    I have a table loan_detail
    and a column in it loan_amount
    now i want to pick values from this table using cursor and then by using iteration i want to pick max value from it using that cursor
    here is my table
    LOAN_AMOUNT
    100
    200
    300
    400
    500
    5600
    700i was able to do it using simple loop concepts but when i was trying to do this by using cursor i was not able to do it .
    Regards
    Peeyush

    SQL> SELECT MAX(sal) Highest_Sal,MIN(sal) Lowest_Sal FROM emp;
    HIGHEST_SAL LOWEST_SAL
           5000        800
    SQL> set serverout on
    SQL> DECLARE
      2    TYPE tmp_tbl IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
      3    sal_tbl tmp_tbl;
      4    CURSOR emp_sal IS
      5      SELECT sal FROM emp;
      6    counter INTEGER := 1;
      7  BEGIN
      8    FOR i IN emp_sal LOOP
      9      sal_tbl(i.sal) := counter;
    10      counter := counter + 1;
    11    END LOOP;
    12    DBMS_OUTPUT.put_line('Lowest SAL:' || sal_tbl.FIRST);
    13    DBMS_OUTPUT.put_line('Highest SAL:' || sal_tbl.LAST);
    14  END;
    15  /
    Lowest SAL:800
    Highest SAL:5000
    PL/SQL procedure successfully completed.
    SQL> Even smaller
    SQL> DECLARE
      2    TYPE tmp_tbl IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
      3    sal_tbl tmp_tbl;
      4    CURSOR emp_sal IS
      5      SELECT sal FROM emp;
      6    counter INTEGER := 1;
      7  BEGIN
      8    FOR i IN emp_sal LOOP
      9      sal_tbl(i.sal) := 1;
    10    END LOOP;
    11    DBMS_OUTPUT.put_line('Lowest SAL:' || sal_tbl.FIRST);
    12    DBMS_OUTPUT.put_line('Highest SAL:' || sal_tbl.LAST);
    13  END;
    14  /
    Lowest SAL:800
    Highest SAL:5000
    PL/SQL procedure successfully completed.
    SQL> Edited by: Saubhik on Jan 5, 2011 4:41 PM

  • Any way to use cursor values inside other cursor by bulk collect?

    hi,
    Is there any way to use cursor get_tables value insdide loop get column if i am using bulk collect in both cursors?
    I tried a lot but i am nt able to do it.kindly help...
    create or replace procedure MULTIPLE_CURSORS_PROC is
    v_owner varchar2(40);
    v_table_name varchar2(40);
    v_column_name varchar2(100);
    cursor get_tables is
    select distinct tbl.owner, tbl.table_name
    from all_tables tbl
    where tbl.owner = 'SYSTEM';
    cursor get_columns is
    select distinct col.column_name
    from all_tab_columns col
    where col.owner = v_owner
    and col.table_name = v_table_name;
    begin
    open get_tables;
    loop
    fetch get_tables into v_owner, v_table_name;
    open get_columns;
    loop
    fetch get_columns into v_column_name;
    end loop;
    close get_columns;
    end loop;
    close get_tables;
    end ;

    hi there
    Refer this
    CREATE OR REPLACE PROCEDURE MULTIPLE_CURSORS_PROC
    IS
       TYPE scol IS VARRAY (10000) OF VARCHAR2 (32767);
       v_table_name    scol;
       v_column_name   scol;
       TYPE curtyp IS REF CURSOR;
       get_columns     curtyp;
       CURSOR get_tables
       IS
          SELECT   DISTINCT tbl.table_name
            FROM   all_tables tbl
           WHERE   tbl.owner = 'SYSTEM';
    BEGIN
       OPEN get_tables;
       LOOP
          FETCH get_tables BULK COLLECT INTO   v_table_name;
          FOR indx IN v_table_name.FIRST .. v_table_name.LAST
          LOOP
             SELECT   DISTINCT col.column_name
               BULK   COLLECT
               INTO   v_column_name
               FROM   all_tab_columns col
              WHERE   col.table_name = v_table_name (indx);
             FOR ind IN v_column_name.FIRST .. v_column_name.LAST
             LOOP
                DBMS_OUTPUT.put_line (v_column_name (ind));
             END LOOP;
          END LOOP;
          EXIT WHEN get_tables%NOTFOUND;
       END LOOP;
       CLOSE get_tables;
    END MULTIPLE_CURSORS_PROC;regards
    Hitesh

  • Report using cursors and loop

    Hi,
    can anybody suggest what kind of report and in what way I have to use if I want to write query using cursors within loops?
    Thanks!
    Karina.

    Hi,
    I found the solution. I just rewrite all cursors within one SQL statement and it works.
    Karina.

  • Using Cursor in Select statements? How to do this?

    I am getting an error whilt passing a cursor to a select clause:
    SELECT dbms_xmlquery.getXML('select deptno, dname, '||
    'cursor(select empno, ename, sal from emp e where e.deptno = d.deptno) employees '||
    'from dept d where d.deptno in (10, 20)')
    FROM dual;
    DBMS_XMLQUERY.GETXML('SELECTDEPTNO'||'CURSORIS(SELECTEMPNOFROMEMPEWHEREE.DEPT=D.
    <?xml version = '1.0'?>
    <ERROR>oracle.xml.sql.OracleXMLSQLException: ORA-00923
    : FROM keyword not found where expected
    </ERROR
    THIS IS DUE TO THE CURSOR AND ITS FROM STATEMENT?
    CAN ANY ONE PLEASE GUIDE AS TO HOW TO USE CURSORS IN A SELECT STATEMENT PLEASE?

    Another duplicate thread. See my response Select CLAUSE error using CURSORS & XSU.Please SEE..
    Cheers, APC

  • How to create weighted graph using as 3.0

    Hello Frnds,
    I want to create weighted graph using AS. Using
    flash.graphics.* package I can create edges and nodes but I dont
    knw how to assign weight to the edges. I am also facing one issue,
    our client has created some legacy classes for graph generation,
    how can I create a similar class in AS.
    Regards,
    FlexBee...

    Hi,
    can anyone tell me about weighted graph...??

Maybe you are looking for