Replace several subsets of table

I have a 1 d table that I want to manipulate.

I want to replace the n-th element to the nth + j with zero element... and repeat this replacement to an integer multiple of n.

So, for example if n = 5 and j = 2, beginning with an array of 1s and then manipulation table might look like:

1,1,1,1,1,0,0,0,1,1,0,0,0,1,1,0,0,0,1,1, etc.

So n = 5 to n = 7, n = 12, n = 15 n = 17 n = 10... etc is equal to zero.

I if the value of n and j with controls on the front panel.

I'm coming from a background of Matlab and slowly get into Labview.

Appreciate the help!

Joe_Le wrote:

I'd appreciate really indications at this point, I solution mathscript work and would really like to know the 'labview solution '.

As you will see, a LabVIEW solution will be much simpler. The most important part would be to learn more about the shift registers. This is one of the basic tools.

Here's a very rough draft of 2 minutes. Modify if needed. Of course replace you your real table and allows to get the size of the array size. See how far you get.

Tags: NI Software

Similar Questions

  • Replace the subset of table operation

    I have a code to a key VI event down that toggles the visibility of some indicators in response to press the function keys. Records using Boolean shift, the code worked with a few indicators.

    To scale to a large number of indicators, I decided that I would need convert a registry to offset single Boolean array.

    With the shift table Boolean register, for a given function key, the code reverse the Boolean value of the table for the property node Visible, then replaces the same item in the table of Boolean with the inverted Boolean value. The code does not work. Once the indicator is visible, he won't go invisible on the next push of button.

    I watched the execution, display values. Looks like that replace it table subset VI is not replace the Boolean value with the updated value. In the attached screenshot, you can see where I got the element of the array once it has been "updated" to replace table VI of subset. Impossible to find all the bugs in the list of bug LV2013.

    See the attached screenshot. What's wrong with this code? My apologies for the resolution of the screen capture. If necessary, I'll go back to the lab and try to capture a screenshot of higher resolution.

    On-screen turned your empty Boolean arrayis, in other words, it has no elements. Subset of the table Replace does not work with an empty array.

    See you soon,.

    McDuff

  • Replace the subset of table does not not for me

    I have a loop IN which I want to use a 1-d output Boolean of the comparison table.  There is a one-to-one correspondence between the index of the loop AND array index, so the number of loops and the size of the table are the same.  I first tried using the function insert in the table, which worked well, except that the table kept gaining in size.  Once I understood that, I replaced it by the function replace table subset, which seemed more appropriate.  However, this does not work: nothing ever appears in the table.  I tried using numbers instead of Boolean values, as an experiment, but that no longer works.  I am at a loss as to what I'm doing wrong or not understand and would appreciate suggestions.  I have attached a picture of the relevant part of the VI.

    Thank you

    Scott

    Note to admin - attachment deleted by user request - 14/04/16

    The shift to your table register is so empty and unitialized.  You can't replace an elmenent that does not exist so that the table remains empty.  You must initialize an array before the loop with the appropriate size and he lead the shift register.

  • Sudden problem with replacement of subset of table

    Hello

    I was working on my project when suddenly a strange problem appeared.

    I have a graph of intensity with 2 sliders that determine the coordinates of my area of interest. I created a simple solution to get these details and store them in table 1 d (x 0, y0, x 1, y1), hence I take them more later to perform some calculations. Now: it's all working fine and dandy that came out of nowhere share the table stopped storing the coords correctly. I put some sensors and index of the sliders and coordinates the eye to be acquired properly. But, for some reason, the function replace subset table stopped their storage in the appropriate cells. Whenever I move a cursor, its coordinates are now stored in the first two cells of a table. I'm pretty sure that I has not changed anything in the code, so what could be the cause?

    Screenshot attached.

    Oficmajster wrote:

    Yep, I added new cases of events previously: cursor type? It was empty, until he did change and why?

    If you don't the wiring of the table in the new case, the table in the shift register will be transformed into a table empty if running new cases. Once the array is empty, replacement of certain elements will not increase the size of the array, it will remain empty.

    Solution: wire the table across all new cases (if you create tunnels of entry-related, it will be automatically )

  • How to replace the subset of table nd with table 1 d to i, j

    Hello

    I am trying to replace a range of values in an array multidimensional, beginning with the cell i, j, both greater than 0, that is to say a square inside the Bay of nD. The new values which replace older ones come from a 1 d table. However, when I provide two indexes to replace table subset block I get a bad wire... I guess it is due to the fact that labview does not know which direction to replace data? Is there a solution to this? I enclose an example vi of what I'm trying to do.

    Thank you very much.

    This should do the same thing without all the extra steps.

  • replace the subset of table

    I have a problem that I can't solve.  I have a table of 6 valves that are a def type.  I want to tell those who are on the use of a loop for.  The for loop count is a wiring number of valves that are put to the test.  I expected indicators 1 to 5 to turn it on in the example, but only 5 shows on.  Can you tell me what I am doing wrong?

    I just thought of it, sorry to bother you.  I changed the entry to a shift register tunnel and left the tunnel to exit as last value is always connected to the indicator of the valve.

    Thank you.

    Metzler wrote: I don't think that your diagram without the loop will work - the original valves begin by the status of the led off.  This is part of a machine to States that tests up to six valves.  County of the Terminal loop is used to iterate the loop many times according to the number of valves tested.

    Then use the array to initialize.

  • Replace the subset of table w/Shift Register too slow for my Application

    This is similar to other posts, but I have not found one that addresses the limitations of an approach of shift register.

    I have a part of an application that I'm turning to 500-1, 000Hz.  The process extracts a block of data from the ADC, and I need to store this data, then collects more of the ADC.

    I've set up what seems to be the bottleneck of the present in the attached .zip file.  When I run the attached code with profiling (see. PNG file), it tells me that it takes on average 3.8ms for the Subvi to run.  At this rate, I can only run around 260 Hz.  I have a Subvi similar to this in my code and the code can run at 1000 Hz without this Subvi, but slows down to about 160 Hz when it is activated.

    Is it possible that I may collect data about 1.7 KB tables and run at the speed I need?  Any input would be appreciated.

    For purposes of reference. Debugging should be disabled on the sub - vi.

    Looking at the code you provided - don't just disable debugging -! you have some other options of "exécution" to reset.

    This should speed up the Sub - vi SR will be your friend again!

  • A question about the count of several lines of table in a PL/SQL block

    Hi all




    I have a problem on counting the rows from several tables in a PL/SQL block, and I would be grateful if you could kindly give me a helping hand. Here's my problem: file in Microsoft Excel (one column) I have a list of several names of tables. For each table, when the number of rows is equal to 10000 I have to call a procedure. Here's how I tried to do:
    DECLARE
         CURSOR tb_cursor IS
              WITH my_table_names AS
                   (
                        SELECT  'table1'  AS tbname  FROM  DUAL  UNION
                        SELECT  'table2'  AS tbname  FROM  DUAL  UNION
                        SELECT  'table3'  AS tbname  FROM  DUAL  UNION
                        SELECT  'table4'  AS tbname  FROM  DUAL  UNION
                        .
                        .  Here I continue writing one line for each table in order
                        .  to have the table names stored in my Excel file as a table 
                           to be queried by SELECT statement
                        .
                   )
              SELECT *
              FROM my_table_names;
    BEGIN
         -- Here I verify that for each table having more than 10000 lines
         -- I call the specified procedure which is needed
         
         FOR I IN tb_cursor LOOP
              DECLARE
                   -- Here I declare a cursor for counting the number of rows
                   CURSOR currentTableRowCounter IS
                        SELECT COUNT(*) AS rowsNum
                        FROM I.tbname;
                        
                   numberOfRows currentTableRowCounter%ROWTYPE;
              BEGIN
                   OPEN currentTableRowCounter;
                   FETCH numberOfRows INTO numberOfRows;
                   CLOSE currentTableRowCounter;
                   
                   IF (numberOfRows.rowsNum > 10000) THEN
                        -- And here I will call the procedure which has to be run
                   END IF;
              END;
         END LOOP;
    END;
    /
    I already checked this code with tables inividual and it works. The only problem is
    . . .
    SELECT COUNT(*) AS rowsNum
    FROM I.tbname;
    . . .
    Indeed, oracle considers "I.tbname" as an unknown table name (although he refers to by its exact name).
    SQL> @script.sql
    
                                    FROM I.tbname;
                                           *
    ERROR at line 99:
    ORA-06550: line 99, column 12:
    PL/SQL: ORA-00942: table or view does not exist
    How can I solve this problem? I mean, how to use a variable (in my example, I.tbname) as the table name in the FROM clause to query a table instead of explicitly write the name of the table?





    Thanks in advance,
    Dariyoosh

    Replace the following code:

              DECLARE
                   -- Here I declare a cursor for counting the number of rows
                   CURSOR currentTableRowCounter IS
                        SELECT COUNT(*) AS rowsNum
                        FROM I.tbname;
    
                   numberOfRows currentTableRowCounter%ROWTYPE;
              BEGIN
                   OPEN currentTableRowCounter;
                   FETCH numberOfRows INTO numberOfRows;
                   CLOSE currentTableRowCounter;
    
                   IF (numberOfRows.rowsNum > 10000) THEN
                        -- And here I will call the procedure which has to be run
                   END IF;
              END;
    

    By the following:

    Declare
      numberOfRows number;
    begin
      EXECUTE IMMEDIATE 'select count(*) from '||I.tbname into numberOfRows;
    
      IF (numberOfRows.rowsNum > 10000) THEN
        -- And here I will call the procedure which has to be run
      END IF;
    end;
    

    Max
    [My Italian blog Oracle | http://oracleitalia.wordpress.com/2010/01/10/crittografia-in-plsql-utilizzando-dbms_crypto/]

    Published by: Massimo Ruocchio, January 12, 2010 15:25
    Added Variable Declaration

  • 2D subset of table 3D display

    Hi-

    I have a 3D table 1000 x 1024 (rows) x 1024 (passes) (pages).

    The attached vi allows the user to dynamically select all

    Section 2D of this table (using the three sliders) and display

    It's in a graph of intensity.

    Code freezes when I select a page # superior to ~ 750.

    Is my code fundamentally flawed or less than optimal in terms of memory

    its use and speed?

    I am slot that lv2010 64-bit on a 64-bit machine Windows 7 with an Intel processor

    I7 CPU X 990 3.47 GHz with 16 GB of memory. It is a multi-core system.

    The number of hearts appears in the Panel before the vi.

    Your help is appreciated!

    Thank you

    Dar

    I see a few things that could make a difference.

    1 the most important factor in the memory usage is the initial allocation in the loop for.

    2. the use of local variables can create copies of additional data.

    3. your graphic intensity is type DBL while your data is I16. This creates a copy of additional data. As odessy27 suggested, move the Terminal inside the while loop and eliminate local variables.

    4 index table seems to be the same as your subset of table and table to reshape and done with less allowances buffer. I tried with the two methods in the same VI and put an equality comparison on the berries of the output to check it out.

    5. place the terminals of the Page, line and column in their boxes of the discipline concerned obviously clearly indicates how these data are used.

    In the pictures below the upper loop shows my changes. The lower loop is your VI. The line and the collar: changed value are identical except for the index is connected.  The black squares show buffer allocations: 2 and 4.

    Lynn

  • REGEXP replace several Chr (10) by simple Chr (10)

    Hello

    I can replace multiple spaces with a space
    SELECT REGEXP_REPLACE('#  #','( )* ',' ') x FROM dual;
    X
    ---
    # #
    But how can I replace several CR?
    SELECT REGEXP_REPLACE('#'||CHR(10)||CHR(10)||'#','('||CHR(10)||')* ',CHR(10)) x FROM dual;
    does not work. How should I write the model?

    Oracle Database 11 g Enterprise Edition Release 11.2.0.2.0 - 64 bit Production

    Concerning
    Marcus

    example:

    with t as (
              select '#'||CHR(10)||CHR(10)||'#' str from dual union all
              select rpad('#',10,chr(10))||'#' from dual
              )
    SELECT str
          ,REGEXP_REPLACE(
                            str
                           ,CHR(10)||'+'
                           ,CHR(10)
                           ) x
    FROM t
    

    Kind regards
    Malakshinov Sayan

  • Import with impdp.exe just add or REPLACE content of the table?

    Suppose I have I dumpfile that I want to import with the impdp.exe tool.
    Part of the dumpfile is the content of e.g. TABLE testtable123

    Also lets say that after the previous export of the dumpfile
    some data are added to the table, while other data rows have been deleted in the meantime.

    So if I now running the impdp.exe operation are ADDED just dumpfile data
    for existing data in the current testtable123 of the table or it REPLACES completely
    all rows of data in the testtable123 table?

    Peter

    So if I now running the impdp.exe operation are ADDED just dumpfile data
    for existing data in the current testtable123 of the table or it REPLACES completely
    all rows of data in the testtable123 table

    [http://download.oracle.com/docs/cd/B14117_01/server.101/b10825/dp_import.htm#i1006538]

    Note that if CONTENT = DATA_ONLY is specified, the default value is APPEND, not JUMP

    TABLE_EXISTS_ACTION = {SKIP |} ADD | TRUNCATE | REPLACE}

    APPEND the rows from the source management and leaves unchanged the existing lines

    REPLACE deletes the existing table and then creates and loads it from the source. This is not a valid option if the CONTENT parameter is set to DATA_ONLY.

    HTH
    -André

  • Several problems with a simple replacement of the subset of table

    I'm new to LabVIEW and I try to teach me how to use it.  As you can imagine, I'm running into a few barriers.  The code that I'm including embodies many of my problems.  If someone can explain to me how to improve this code, I would be grateful.

    Copy the following code is a simplified version of a more complex code, that I'm writing.  In the simplified code, I have a control ('VALUE') that I would like to register at different locations in my table of 5 x 3.  To do this, I tried to make a 5 x 3 constant I could replace it with the value of the control.  The code does not work as expected and this is my specific problems:

    1. I can't initialize the array constant (the one I intend to crush).  I can only initialize the first row.  Based on the help files, I thought I should be able to initialize it by clicking on the boxes in the chart on the block diagram and entering values.  But it doesn't seem to let me do this.  Don't know if there is a special way to open when more than 1 dimension is involved?

    2. my slider controls are intended to establish where in the table to place the element.  But is not no longer works.

    3. I can't understand how properly to a code which has a while loop integrated in a while loop.  Someone recommended using a structure of the event, but as a beginner, I will have trouble to know how I would enact who.  I tried to play with the settings of locking/switching the button stop, but that did not work, either. The problem seems to be that, if I am inside the while loop, the program does not see my stop command.  Is there a way to connect as the stop button works, regardless if I'm inside the another while loop?  If not, is there a way to accomplish what I want in the smallest loop without using a while loop?  If I used a structure of the event, how would I created an 'event' to tell the program to store a new data point in the array?

    Thank you.

    Jessica

    Jessica,

    Also note that in LabVIEW array indices are zero-based.  If the values of the row index can be 0, 1, or 2.  If you want your users to see 1, 2, and 3, then put a function decrement between the terminals of the cursor and the function replace table subset.

    Lynn

  • subset of table truncate the end of the 2d array

    The intention was to make a program that would generate asynchronous several different signals in a buffer.  Then something would consume the buffer - an output daq, and signal processing.  I created a dummy consumption which takes only 1% over the beginning of the buffer.  Whenever the buffer is smaller than the specified size, more signal will be added at the end.

    I ran into a problem where the function of the subset of the Array is truncate the end of the subset sometimes, so I disassembled the program until a congruent portion of the code exists to cause the problem.  It seems to be the use of memory or related allowance.  Maybe I'm doing something that I shouldn't be, but it seems like a bug in labview.  In the block diagram, I have a note that shows a waveform wire that goes to a case statement.  Just remove this thread causes it to work properly as seen by the consistency of the waveform on the front panel.

    I'm using Labview 2014 (without SP1)

    I would be grateful for any ideas.

    To work around the problem, use the copy always at the moment. I'll try to engage someone R & D of LabVIEW to get the last word.

    In any case, it seems unnecessary to carry all these t0 (which is always zero!) and dt (which is always the same. Constantly from waveforms to bays and back just really clutters the code. If dt would be different between the waveforms, you would have a much bigger problem .

    I understand that your actual code is much more complicated and what you show is just the tip of the iceberg lettuce.

    Here is a general overview of execution project ideas.

    • Use 'building the table' (concatenation mode) instead of "insert into array. It's cleaner.
    • Use simpler and easier to read the code to find the size of the table smaller
    • Only use tables. You can define once and dt for all graphs.
    • Use the correct representation for buffer size controls.
    • Don't place unnecessary sequence structures.
    • I don't think that you really need that local variables, the terminal is written often enough (stops you extra copy of the immense tables in memory!)
    • Do not know what is the structure of matter, but I left it in for now.
    • Add conditionally empty bays, just wire the table via unchanged instead.
    • ...

  • Dynamic data of several channels in table, then save in Excel

    Hello

    I am acquiring data from several channels (4-5) and I'd like to collect samples at low rates (10 Hz for 3 minutes max). For various reasons I use Dynamic Data type, although I know that it is not the best way (some say it is a wrong data type ). I also want to save data to a file (the best option would be data excel file).

    If I acquire data 10 times per second, it is quite slow to save in excel (this is the slowest option of all types of data). So I would like to fill a table or matrix of acquired data and then write Excel file (I use scripture to measure file). But I don't know how to do - if I convert DDT in DBL, build an array and connect it to change registry, it works but I lose the information in column names and I'm wasting time. If I connect to build the table a DDT and then shift record another, it returns the table 1 d of DDT. I would like to have 2D DDT, which collects all the information loop.  Is there a suggestion how to solve?

    I'm sure it would be easier solved my problem with the double data type but I also use select signals VI which is the VI I am not able to replace at this time.

    Good day

    Lefebvre

    I don't know if there is a question here, or what.  Doing what you say you want to make, acquire the data of 4-5 channels at low rates (10 Hz for 3 minutes) and save the data in an Excel file (I assume you mean really Excel, i.e. a file with the extension .xls or .xlsx) is really a very easy thing to do in LabVIEW, especially if you are not using :

    • DAQ Assistant
    • Dynamic Data
    • Write to the action file.

    Indeed, you seem to realize this, but I guess you want to 'do the hard', in any case.

    Good luck.

    Bob Schor

  • Several tabs in table cell (7 FM)

    Hey gang,

    I have a table that requires several tab stops in a cell.  They are fairly easy to place - I use the segment of tab in the paragraph Designer stops - but I can't come and go between the legs. Each tab stop must be numbered.  For example, I inserted seven of the tab stops in the cell.  Is there a way to review the tab stops without leaving the cell?

    Thanks in advance!

    -terry-

    And Esc_Tab just inserts a new tab.

    Until something more elegant is posted...

    1. Open the Find/Replace dialog box.
    2. Use Esc_Tab to put a \t (tab) in the find: text: field.
    3. Use [find] to switch from one tab to the tab tables.

Maybe you are looking for