Fastest way to format an array of numbers

I am collecting 2D array of DBLs to be later processed by other Vis.
  The process worked fine when I saved the array to a file (standard %.3f, write to spreadsheet) formatting, then later have a separate VI to open the file and process it.
The same process did not work when I tried to process the 2D array on the fly, without saving/opening to file.
  After debugging, I found out what was holding me back. Yep you guessed it, the formatting. Without save to spreadsheet, instead of “0.000”, the value is not 2.803E-42 (I need to to be 0.000). What is the most efficient way to format the numbers to “.3f”,  on the fly (without saving to file)?
Best,
  Santiago

.3f is the same as a precision of 3 input to the number to fractional string vi (which can handle arrays automatically)
 To keep only a precision of 3 you can also do it numerically by multiplying by 1000, rounding then dividing by 1000. 
Here is a screenshot of the code using the two different methods. The numeric method should be fastest.
Systems Test Engineer
Certified LabVIEW Architect (CLA)
Attachments:
format array of numbers.png ‏4 KB

Similar Messages

  • Fastest way to write array of million longs to file

    Hi,
    I have an array of 200 million longs. What is the fastest way to write this array to a file, so that I can read it back later. I tried looping, but that is too slow.
    Thanks,
    Taran

    Maxideon wrote:
    Can't he store a portion of those longs into a very large byte array, write the array, and then rinse and repeat? This would increase size of the file writes and should spead up the time...It's still looping. Simply using buffering will decrease the I/O overhead significantly. No need to munge pre-I/O buffering ourselves.

  • Sorting an array of numbers with loops

    Hi, i'm looking for a way to sort an array or numbers with loops.
    my array looks like this. int[] numbers = {5,2,7,9,1}
    i know how to use the "sort" method and i want to do it without the sort method, but i am not very clear on the logic behind it.
    by the end it should look like this, {1,2,5,7,9}
    i know 2 loops are used, can you please give me a logic to work with.
    i have started the loops but what to do inside???
    int temp;
    for (int i=0; i<numbers.length; i++){
    for (int j=1; j<numbers; j++){
    if (numbers<numbers[j])
    temp = numbers[i];
    Any suggestions i will be thankful for.
    thank you.

    fly wrote:
    no not really a homework question.. i want to improve my logic because it is very poor at the moment.. but i'm sure someone knows how to sort an array with loops only.Yes, we do know how to do it, I once wrote a heapsort in assembly code, as a real work project. But you rarely get a project like that the good ones were all done years ago.
    All the algorithms I suggested you look at use loops. the simplest and slowest is the bubble sort. This one runs by comparing values and swapping their locations, the wikipedia article http://en.wikipedia.org/wiki/Bubble_sort has the algorithm.

  • Using .sort() to sort an array of numbers NOT as strings

    Hi,
    is there a function or simple way to sort an array of numbers in order of their values and not as strings? E.g, have 100 come AFTER 9; (9, 100) not (100, 9).
    Thanks.

    use the ARRAY.numeric parameter.
    (and you can always use a custom sort function parameter for more customized sorts.)

  • What is the best way to get the minimum or maximum value from an Array of numbers?

    Let's say I have an Array of numbers: [2,3,3,4,2,2,5,6,7,2]
    What is the best way to find the minimum or maximum value in
    that Array?
    Right now, to get the maximum, I am looping through the
    Array, and resetting a variable to the value if it is greater than
    the existing value:

    Here's other approaches, the cookbook is your friend:
    http://digitalmedia.oreilly.com/pub/a/oreilly/digitalmedia/helpcenter/actionscript30cookbo ok/chapter5.html?page=7
    enjoy.

  • I can't seem to find the data tab in format inspector...is there any other way to format numbers as currencies?

    I can't seem to find the data tab in format inspector...is there any other way to format numbers as currencies?

    Hi Aakritie,
    What version of Numbers are you using?
    What operating system?
    Your profile shows  Macbook Pro  (that is OS X) and also iOS
    I am using Numbers 3.2 on a Mac book Pro under OS X 10.9.2
    Format Inspector shows this when a cell is selected:
    Then choose a Data Format:
    Then:
    Regards,
    Ian.

  • Drawing float* buffer fastest way

    Hi,
    I am little out-of-date about pixel buffer objects, native pixel formats, etc. on OSX. Can you briefly point me out what is the fastest way to visualize grayscale data represented as float* 2d array (non power of two domain, [0,1] range) to the frame buffer? Is OpengGL my best option or is there any faster OSX specific direct frame buffer drawing?
    In case of OpenGL, how do I do this. I am using Cocoa, on 10.5x.
    Thanks a lot
    Sunil

    Hi,
    I am little out-of-date about pixel buffer objects, native pixel formats, etc. on OSX. Can you briefly point me out what is the fastest way to visualize grayscale data represented as float* 2d array (non power of two domain, [0,1] range) to the frame buffer? Is OpengGL my best option or is there any faster OSX specific direct frame buffer drawing?
    In case of OpenGL, how do I do this. I am using Cocoa, on 10.5x.
    Thanks a lot
    Sunil

  • How can I format a cell in Numbers to have leading zeros in a number?

    I imported a spreadsheet from Excel (Office 2014, Win 7) through iCloud and some numbers were formatted to have leading zeros (012358) in the original Excel file but the leading zero format was lost in Numbers.  Is there a way to format cells to have a number displayed with the leading zero in Numbers?  The leading zero is part of an identification and is important to the numbers (0027 is not the same as 27 in these records).
    thanks,
    Bob

    James has the formating part, but if you already did the import you can use the following formula to replace the zeros that were leading if you know it is a four digit reference number....
    =right("000" & A2,4)
    copy those values into your text formatted column from James' answer and you got it.
    Jason

  • Fastest way to create subtitles

    Hi! What is the fastest way to create subtitles. I have a short film with one hundred subtitles. I have a text list with time codes, can I use that somehow? Or do I have to enter every subtile separately? And what are the basic settings?

    A possibility seems to be using Quicktime Pro to add your text to a Quicktime movie. The Apple instructions are in Text Track Tutorial. I never used it in real life,... but I tested it in the past and it seemed to be doing what I expected: to layout text over an existing movie at preassigned timecodes...
    For sure you must first adapt your text and timecodes to the required format, and most of all you must have the "original" timecode in your movie untouched (all timecodes your text is making reference to). But if you edited and exported your movie from FCE you lost the original timecodes... so I'm not sure this may help you.
    The other approach is manual: in FCE add a text clip at the correct timecodes, one at the time...
    Piero

  • How to create a list/array off numbers with boolean attributes

    Hi,
         Maybe the title doesn't explain this too well but what I'm trying to do I'd imagine should be straight forward, I just don't know how!
    I want an array of numbers to be entered by a user, and for each of these numbers I wish to have a boolean, (it will select later what action is performed on that number)
    The array size can vary
    e.g.
    element       Numeric Value              Boolean
    0                       5                             True
    1                       20                           True
    2                       -5                            False
    3                       10                           True
    n                       100                         False
    I don't see any list with numeric and boolean, maybe I just haven't spotted it or do I have to make it somehow?
    Any suggestions please?
    Thanks!
     p.s. if anyone else is using Opera Browser to post here, hitting enter work properly for ye when entering text? For me it causes the cursor to go up one line instead of down! Drives me nuts! It only happens with this NI forum
    Solved!
    Go to Solution.

    Hi thanks for the reply, 
                              It not really what I'm looking for though. 
    I require is a control that inputs both numeric and boolean,  as in the example I mentioned. I guess I'm looking for a cluster really but I thought there may be something more straight forward.
    From the example I gave  
    Element 0 of this array has been entered as a x, and the boolean True was entered (so I perform a "test" A on value x)
    Element 1 of this array has been entered as a y, and the boolean True was entered (so I perform a "test" A on value y)
    Element 2 of this array has been entered as a z, and the boolean False was entered (so I perform a "test" B on value z)
    I could also use a 2d array were I enter another numeric value (0/1 for False/True) but I'm not sure I can limit this column only to accept 0 or zero and the first row any number.
    I was hoping there would be some easier way to do this

  • What's the fastest way to share files live between 2 Macs in the same room?

    Please can I have some advice on this scenario?
    I'll need to share HD video footage between 2 new Mac Pros in the same room. 1 Mac will be used to upload the footage and the other to edit it using FCP. The footage can be stored either on hard drives in the edit machine or on desktop hard drives connected to the edit machine (or if there is a better option I'm open to advice).
    What is the fastest way of sharing the files and what is the simplest way?
    Any suggestions would be greatly appreciated.
    Thanks in advance

    What is the fastest way of sharing the files and what is the simplest way?
    Fastest way? a fiber channel SAN connecting the two machines to a common fiber-channel based storage array. Can't beat it for performance, but it comes at a cost (think $20K as a starting point, depending on the amount of storage you need).
    Simplest way? Some external media (thumb drive, external hard drive, etc.) that you shuffle between the two machines
    Intermediate: a NAS-based storage box on your network, although be aware that real-time editing of HD video can overwhelm many low-end NAS boxes.

  • Fastest way to convert flv videos to a compatible ...

    Hi.
    Which is the fastest way to convert flv videos to a compatible format for the E71?

    It is goog that you are all providing links here for converters but please avoid posting ones wherein it leads to direclty purchasing various products alone as this will be considered as spamming and is not allowed in the boards.
     A fair number of the converters are freeware others are shareware and others let you trial the product either via a short test or watermark . I have posted some that are paid for as well as freeware  but its like mentioning Apple IPhone would that also be classified as spam .Likewise again their are other apps for your phone   if they are not freeware are they classed as spam  if mentioned . Their seems to be no intention of  spamming when asked about a product to do a particular job  and the actual replys fall outside the definition of spamming .If the definition of spam on this board is mentioning paid for applications then the list is long starting with Windows and should not just be applied to this section .
    But as their are so many views as what app to use paid for or free then i see the board as being safe from abuse .
       jje

  • Fastest way to compute C(i,j)=max(A(i,j),B(i,j))

    Hi Ppl,
    I just wanted to know, what could be the fastest way to pick the maximum element from a 2D array .
    That is i want to implement C(i,j)=max(A(i,j),B(i,j))
    I do not want to index each element and select the maximum of two, as it would take more time to execute.
    I tried the below method to implement this. The problem with this is, when a NaN is passed as input, NaN is returned
    as output, irrespective of the other input. I don not want this to happen.
    Can any one suggest a better method to implement this...? 
    Solved!
    Go to Solution.

    Use the Max & Min function node. Not really sure of what the O(n) of that function is.
    Adnan Zafar
    Certified LabVIEW Architect
    Coleman Technologies
    Attachments:
    maxmin.PNG ‏14 KB

  • Fastest way to do a bitwise comparison of 2 large files

    Hello All,
    I have two relatively large files (memory dumps) of approx. 1 MB. Both files have the same size.
    I need to do a bitwise comparison of both the files. (one is the reference file, the other is the measured file)
    What is the fastest way of doing this? I need to know how many bitwise differences there are.
    I need to present the user with a percentage of how good the match between both files is and also the number of differences.
    Mayby later on I also need to list the differences.
    I was thinking about opening the files in binary mode, reading them out and converting them to boolean arrays and with the autoindexing of for-loops determining if there are differences. Probably there are much better ways for doing this.
    Your help is greatly appreciated!
    noxus.

    OK, here's a quick draft (LV 8.0) of what I meant. I assume you know how to read a file as U8 binary array, so let's start with two U8 arrays of equal length.
    The lookup table needs to be calculated only once, then you can replace it with a diagram constant. Still, it is very cheap to do.
    I doubt you can count the number of bit differences much faster that this.
    DIsplay all arrays in binary so you see what's going on. (# of differences" should probably be labeled # of bitwise differences").
    Message Edited by altenbach on 02-14-2007 02:50 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    CountBitDifferences.png ‏8 KB
    CountBitDifferences.vi ‏13 KB

  • Fastest way to access data between String and char[]

    Hi all,
    I've been programming a small String generator and was curious about the best and fastest way to do so.
    I've done it in two ways and now hope you can tell me if there is a "more java version" or fastest way between those two or if I'm totally wrong as some classe in the API already does that.
    Here are the codes:
    version 1:
            //describe the alphabet
         String alphabet = "abcdefghijklmnopqrstuvwxyz";
         //The "modifiable String"
         StringBuffer stringBuffer = new StringBuffer();
         //Just put the temporary int declaration outside the loop for performance reasons
         int generatedNumber;
         //Just do a "for" loop to get one letter and add it the String
         //Let's say we need a 8 letters word to be generated
         for (int i=0; i < 8; i++)
             generatedNumber = (int)(Math.random() * 26);
             stringBuffer.append(alphabet.charAt(generatedNumber));
         System.out.println(stringBuffer.toString());
         stringBuffer =null;version 2:
            //describe the alphabet
         char[] alphabetArray = {'a', 'b', 'c', 'd', 'e', 'f',
                        'g', 'h', 'i', 'j', 'k', 'l',
                        'm', 'n', 'o', 'p', 'q', 'r',
                        's', 't', 'u', 'v', 'w', 'x',
                        'y', 'z'}
         //The "modifiable String"
         StringBuffer stringBuffer = new StringBuffer();
         //Just put the temporary int declaration outside the loop for performance reasons
         int generatedNumber;
         //Just do a "for" loop to get one letter and add it the String
         //Let's say we need a 8 letters word to be generated
         for (int i=0; i < 8; i++)
             generatedNumber = (int)(Math.random() * 26);
             stringBuffer.append(alphabetArray[generatedNumber]);
         System.out.println(stringBuffer.toString());
         stringBuffer =null;Basically, the question is, what is the safest, fastest and more "to the rules" way to access a char in a sequence?
    Thanks in advance.
    Edited by: airchtit on Jan 22, 2008 6:02 AM

    paul.miner wrote:
    Better, use a char[] instead of a StringBuffer/StringBuilder, since you seem to know the size of the array in advance.
    Although I imagine making "alphabet" a char[] has slightly less overhead than making it a String
    1. It's a lot clearer to write it as a String.
    2. You can just call toCharArray() on the String to get a char[], instead of writing out each char individually.
    3. Or if you're going to be using a plain alphabet, just use (randomNumber + 'a')
    And use Random.nextInt()Hello and thx for the answers,
    I know I shouldn't put constants in my code, it was just a piece of code done in 1 minute to help a colleague.
    Even if it was just a one minute piece of code, I was wondering about the performance problem on large scale calculating, I mean something like a 25 characters word for billions of customers but anyway, once again, the impact should be minimal.
    By the way, I didn't know the Random Class (shame on me, I still don't know the whole API) and, I don't understand why I should be using this one more than the Random.Math which is static and thus take a few less memory and is easier to call.
    Is it because of the repartition factor?
    According to the API, the Random.Math gives (almost) a uniform distribution whether the Random.nextInt() gives a "more random" int.
    I

Maybe you are looking for

  • Moving RAW files from one drive to another without loosing all your work in Lightroom

    I am posting this for two reasons, the first is I have been trying to figure out how to get my raw files off my hard drive & onto my external hardrive for ages, as my laptop is filling up & slowing down with the huge files my new camera captures. I h

  • Default application ip redirection

    Hello, I cannot imagine a good subject so I just typed random stuff which you can follow. So my problem is that I have an web adres like myprogram.mertov.com. When you type it automatically goes to page 'myprogram.mertov.com/apex/f?p=4550:1' (you kno

  • Oracle VM Guest Performance as HVM

    All, I was hoping to get clarification on this: I happen to have a server with a processor that supports virtual machine in hardware (AMD-V). I have installed a couple of 64-bit OEL5u4 VMs off of the install iso (not from eDelivery templates, but fro

  • System Overload/Core Audio Error Message when recording/playback

    Well ive been experience this problem for a while now but ive read up on it and done some troubleshooting and think i may have found a solution. Well what happens is ill be recording say one track or 2 tracks in mono or stereo or playing back about 3

  • Why the remote user cannot open any folds?

    Why the remote user cannot open any folds? I create a user user8 and already grant the user the role connect, OLTP-user, and resource. I also assign this user unlimited space in the user8 tablespace. But after connection, the user8 cannot open any fo