Manipulate a large array of integers

Hello

I have a table 1 d with over 1 million items. I need to 'out' everything and put it into a new table.

Currently, I have a loop 'for' that divides the 2 loop index. If there is no remainder she ignores this index. If there is a rest it indexes the table to that element and puts the item in a new table.

After ~ 300 000 elements, the program slows down considerably.

Any suggestions?

Thank you

Steve

Try the primitive to decimate Array.  Use it with two tables of output (by default: it is expandable) and do not connect one you do not need to use.

Lynn

Tags: NI Software

Similar Questions

  • Array of integers with array of bool

    I have an array of integers large read in a worksheet. All ones and zeros.

    The table is 200 000 length and width 10-bit words. I need to convert to an array of Boolean in order to

    create a chart of digital waveforms. I can convert it using loops, but it will take more than an hour.

    Is there a quick way to convert an array of 200 000 x 10 of integers (ints) to an array of bool?

    This should be much faster than the curls.  I was not looking for it with a great picture.

    Lynn

  • How to get an array of integers to user in the User Interface

    Hi all. I'm not a very experienced user of the CVI. I have almost exclusively coding in LabVIEW but have a client who wants all of their work in the CVI.

    I've been very fruitful so far (set up a Modbus API from scratch that supports all types of connection) but am confused on how I can get the integer multiples of the user without limiting the number of integers I can get. Essentially, I need to be able to get an array of integers to the user.

    General information, I am building a user interface to test my Modbus API. There are Modbus functions to 'Write multiple registers' and 'write multiple coils. I want the user to be able to enter all the values they want to write in one command.

    What is the best way to get an array of integers through the user interface?

    The easiest way is probably to allow user input in a textbox control numbers: items can be separated by spaces, commas, or even a line break (using ctrl + Enter). You will then need to extract the string from the TextBox and analyzed for numeric values using any non-digit character as a separator: strspn (string, '0123456789'); can be used for this.

    More complex, another possibility is to use a table control to receive user input: you Dresses an empty table with a reasonable number of roews, or you need some codes to add new lines as long as the user fills all those already existing. On the other hand, it will be easier since data recovery in a simple statement, you will all return values: GetTableCellRangeVals (panelHandle, PANEL_TABLE, VAL_TABLE_COLUMN_RANGE (1), table, VAL_COLUMN_MAJOR);

  • Converting a string to an array of integers (ints)

    I need to do ot an app that will read in numbers, or data means, in a text file on an SD card and then convert them in a line graph. Currently I am able to read the contents of a text file and store it as a string with this code

     private String readTextFile(String fName) {
            String result = null;
            FileConnection fconn = null;
            DataInputStream is = null;
            try {
              fconn = (FileConnection) Connector.open(fName, Connector.READ);
              is = fconn.openDataInputStream();
              byte[] data = IOUtilities.streamToBytes(is);
              result = new String(data);
            } catch (IOException e) {
              System.out.println(e.getMessage());
            } finally {
              try {
               if (null != is)
    
                is.close();
               if (null != fconn)
                fconn.close();
              } catch (IOException e) {
               System.out.println(e.getMessage());
              }
            }
            return result;
            }
    

    I am able to print the result of the chain of my test file so it prints something like "1 2 3 12 14 2 42.

    What I want to do convert this string to an array of int that will look like int [] result = {1, 2, 3, 12, 14, 2, 42}.

    I tried to use string.split("") as this seems to be what is generally done when I have the problem of google. When I try this however I get an error "the split (String) method is not defined for the String type.

    I just want to know if there is a way to convert this string to an array of integers (ints), or maybe is it possible to change my readTextFile method so that it will display the data in a table or working with the array of bytes to get distinct integers.

    Hi try this

  • How to make the tank table in the array of integers

    Hello

    If I give the input array unsigned char as a [] = {12, 45, 89, 00, 45, 12, 67, 12};

    I want to exit as follows in the table int unsined [b] = {12458900, 45126712};

    Thanks in advance,

    Kind regards

    Harish. G.

    Hi Harish,

    in your first thread you want to create arrays of bytes larger integers BCD, and now you have to return the same way?

    The bases were shown to you: you had to change some simple calculations!

    You should really have stuck to your first thread...

  • Remove numbers first in an array of integers 2D

    Hello

    I created a program that generates numbers said pitchblende probably the first: these are integers, which are almost always of the first: I would like to keep only those that are not the first (they are said to pseudo-premier-first-strong).

    Here is the part of the program that is supposed to remove these Premiers of my 2D integer array numbers:

    As you can the utiiese by running the program as an attachment, I have a sub VI which is a Boolean function that returns true if a number is Prime Minister, and false otherwise ('Nb Prime Minister' on the diagram). I don't understand why this part of code has no effect. The first column of my table consists of integers (the of I call this 'base').

    I add the two subprogrammes Québec pluggable attachments, in case (but I don't have a problem with them).

    Could you point me to a safe method pour delete numbers first in a Board of 2D integers?

    Thank you very much in advance!

    Two remarks without taking the time to look at your code in detail:

    1. A 2D table must include the same number of lines in each column. You treat the 2D column-by-column table to remove the primes of each of them. Since the number of "items to remove can be different from one column to the other, this method is not recommended. LabVIEW will take into account the column with the most number and complement the other with 0. In your case, par chance, the result may be acceptable, but please understand that this is a bit lame.
    2. If the number is Prime Minister, it is removed from the current column. Therefore reduces the size of the column and the numbers following the coming to be erased so shift forward. This means that the next iteration of the inner loop, the table (column), passed by a shift register, will not BE the same. Or you don't take no account of this using the counter (i) iteration of the loop without correcting it every time a prime number has been removed. The next number one who comes to be deleted so escape analysis.

    I'll think about how to fix your code.

    PS: The Subvi checking the rule of the number includes a stacked sequence and useless local variables and making the code reading, more difficult.

  • Large array of bytes sent via socket?

    Hello

    I have had this problem for a while and have never really stood under how to solve it properly. I don't understand how you are supposed to transfer arrays of bytes that are larger than the size of the buffer of the socket. I have semi overcome them chapter by chapter from the table and write through the sleeve and reassemble frequently on the other side, but this causes problems. What is the right way to send a byte array that is larger than the buffer socket on an outputstream?

    I suspect that I am thick here, but I'm not aware that there is something called a socket buffer.  Actually, let me rephrase.  I'm not aware that there is a specific size that was a little to the amount of data to a socket can accept.

    And you should, in theory, be able to send constantly bytes on a socket and the IP protocol should ensure that they arrive in the right order, at the other end, providing the connection is maintained.

    In practice there are limits, but I wasn't aware of a buffer size of socket specific related to the shots of Blackberry (or any Sockets besides /).

    The original poster might explain what determines the size of this buffer?

  • More then 10 to an array of integers

    Well, I want to do the following...

    I have a number (more great then 10). Suppose I got number 4327 now I want as fast as possible to change the figure at a table with the values [4,3,2,7].

    I thought that one of the solutions (which is possible also the faster), but I want to know if maybe somebody has a better idea.

    My solution is just to get that number into a string using the NumberToString VI, "4327", then split into an array of strings ['4', '3', '2', '7'] and cast using the VI StringToNumber.

    Anyone got a better idea quicker?

    Absolutely not!

    Although Nathand solution could be developed to work with any base as well. Maybe it's a bit faster

    the use of native recursion vs the expansion of the buffer should display for the technical recusive to a considerable number of digits.

  • Text string in array of integers - with law enforcement in the text string-

    Hello

    I have a text string containing the measurement frameworks.

    I want to place each image in a first time 0, 11 x 11 array (with the same order in the text file).

    In the figure below, I tried to convert it to a table, but the table only contains the first "column" in the text file.

    Any suggestions?

    Crows is right, your channel is very dirty, with a variable number of spaces, lines starting with spaces and space + newline delimiter.

    In such cases, I like "scan of the channels for tokens", because it can automatically enter into identical consecutive separators in a single. Here's a quick example.

    Your lines are of variable length, a 2D picture seems inappropriate, because all rows have the same number of elements. For example, consider a table 1 d of clusters containing the tables 1 d.

    (Of course, it would be cool "worksheet in table string" could deal directly with identical consecutive separators as found here, so thank you for supporting my idea.) He deserves more than 24 voice )

  • How can I combine a string array and an array of integers?

    I have an array of string data [to use as header] and an entire table of multiple column vakues; I need them together in a single file.

    Am not able to combine so that I could write them in a single file.

    There are several ways you can do.  What I recommend is:

    1. Open the file
    2. Use the table to a spreadsheet string to transform your headers into a single string
    3. Write it to the file.
    4. Use the table to a spreadsheet string to transform your digital data in a single string
    5. Write it to the file.
    6. Close the file
  • Convert the string to an array of integers

    Hello

    I read a TCP Read package.  A string o 248 bytes of output data.  I need to convert only a table of 62 of the U32.  I tried the cast to type in a loop, but that did not work.

    What is the right way to do the conversion?

    Thank you.

    Smercurio_fc is right. I forgot the boutien. Rather than the type cast, you can use the chain Unflatten. Depends on which generates the data.

    No, the TCP/IP Read output is only a string.

  • Remove the equidistant indices into an array

    Hi all

    I have a performance problem. In my code, I use two nested for loops. Externally, runs 500 times each time. Rather, an internally executes once for every pixel that I find in an outline to a picture. Number can range from 10 to 1000. And 500 x 1000 is a large number of iterations. In addition, the difference between the e pixels is minimal, I needn't pixel to build an outline.

    So I thought to leave only 50 pixels to define a contour and whenever I get a certain number of pixels, the vi "remove table" allows to reduce the amount of pixels at 50. But I would avoid for loops, because computational cost would increase even if I need to go on the entire table. For example, if I have 20 pixels, and I want to reduce them to 10, I would choose index 1, 3, 5, 7, 9, 11, 13, 15, 17, 19.

    I don't know if this is possible. Can you help me please?

    I cheked this post:

    http://forums.NI.com/T5/LabVIEW/removing-a-list-of-indices-from-an-array/TD-p/572652

    but this isn't the same problem he uses for loops, in fact, I would say that mine is easier to solve and perhaps very banal, but I can't find a solution.

    Thanks in advance.

    Using Index table inside a loop will produce the results you want and can work quickly enough.  The attached VI selects an item in each element of the 'period '.  For testing purposes, I have two tables, one random DBL and another of sequential I32. The array of integers allows a quick check you get the tables you want.

    When it is used as a Subvi with closed Panel, this averaged 33 microseconds with 1000 pixels and periods of 50 or 100 tables.  The loop Tester ran ~ 200000 iterations before I stopped to check the timing.

    This corresponds to about 17 ms for your configuration of 500 x 1000.

    Lynn

  • Is it possible to define a control in the form of an array of ring box?

    I would like to have a control panel that I can define the dimension and restrict the value use can enter. I thought about a table of ring for which box I could initialyse the dimension. Is it already possible? any reference to where I might start?

    Thank you

    Olivier

    Just drag the control in a container to empty array. If you are referring to a ring of menu, its default data type is U16, so regard LabVIEW, a menu of the rings table would be no different from an array of U16 values, which is an array of integers not signed, 16-bit.

  • acquire a large number of images

    I am trying to get pictures from my camera to the possible largest FPS.

    Each image is an array of integers (1392 x 1040) 2D.

    For now, each cycle I am adding the image in a table of images:

    and this table will - of course - memory.

    Its effect can be detected in the downturn of the acquisition:

    ... which deviates from linear.

    What do you suggest me? Of course, I will need to save the images table and empty it,

    but there are additional tips in Labview that store more efficiently this kind of structures (tables of 2D array of integers)?

    Thank you!

    Alessandro

    alzyx wrote:

    > My suggestion is that you attach all VI, even if she's ugly and takes 20 screens to display (don't worry, many of us have seen much worse).

    Bob, it's the kindest suggestion, thanks! The code I got with the camera Thorlabs and he is really big (and not ugly, I guess).

    The ugly portions are ones I'm introducing to customize! Since I come from VEE and I broke my face against Labview a few weeks ago, I don't know that I make a lot of mistakes :-)

    Ah, another essential piece of information - the camera is a camera of Thorlabs (you don't mention the model) and (probably) use their LabVIEW drivers.  One of the first functions Thorlabs tell you is 'table to Vision", which transformed their Image (owner) format, a table 1 d, table of pixels more intuitive LabVIEW 2D, allowing you to (if you choose) to use the IMAQ functions to process your images.  I dare say, you will find several readers of the Forum know IMAQ faced by Thorlab functions.

    So where is the attached VI?

    > But they were is your array of 2D image?  All you ´placing in a 2D table is a table 1 d.  How do you get the table 1 d of an image?

    dkfire, the image is returned by the camera as a 1 d array and then remodeled:

    See my previous comment on "Vision Board".

    > Curiosity, why you add images in your table, such as "the last shall be first"?

    Bob... well, it's just that when I contemplated the palette table for the first time, the tool "insert into array" seems to be exactly what I need... (and no, it's not a 'reversal of the table"somewhere more later... :-)

    When you try to create a 2D array by adding a 1 d array at the beginning or at the end of a 2D existing (even if it is empty) array, the much-more-natural-and-intuitive-function-to-use is 'Building the table' (Hey, he still sounds logical).  And, as a bonus, when wire you the table 1 d in there, you can Choose in a 'natural' function to build the table in 'normal' order or 'inverse '.

    Bob Schor

  • free the memory of the queue after ingesting large paintings on the RT/cRIO

    I'm working on an application, running on a cRIO, which receives files from the network (up to about 7 MB per file) and transfers data to the FPGA that writes to synchronized with an external signal. The files are never written to disk of cRIO, they are streamed directly from memory on a DMA channel. I can receive files faster I have save output digital, so I put the incoming files in a queue. Each file is simply a large array of bytes, and the queue contains arrays of bytes. Whenever I finished it passing an array to output digital, I remove the following.

    My problem is that, in certain situations, I get files enough to fill the cRIO memory, and that memory don't is released because the elements are removed. It is a normal behavior, according to other threads on this forum. However, I can't find a way to force to free this memory and in some cases, prevents me from download files more - I get error 2 ("memory") when I unflatten the TCP entering a table stream. I tried to add code that empty the enqueues empty tables, queue and then removes the empty bays, but apparently not to free the memory. Anyone have any ideas?

    It comes to LabVIEW 2012SP1, running on a cRIO-9076 with VxWorks like operating system.

    The only way I know to free up the memory of the queue is to destroy the queue.  But according to the architecture you, would not be possible.

Maybe you are looking for