How to eliminate or remove zeros from 1D array

How to eliminate or remove zeros from 1D array. Let say I have 1D array having foolowing elements
"0 0 0 0 0 4 0 0 9 0 0 1 4 0 0 0 0 0 0 0 0 10 9 0 0"
So after removing or eliminating zeros it will become as follow
"4 9 1 4 10 9"
So can any body guide me how can I do that? See attached Image for details.
Thanks 
JK

altenbach a écrit :
hchiam wrote:
Here are 2 example .vi's I made based on altenbach's removeZeroes.png in this discussion thread: 
It seems pretty pointless to post those because no new useful information is given.
Currently, only the input is defined in the connector pane, making them useless as subVIs.
unlike my example using integers, an "=0", like any "equal" comparison, is potentially dangerous with DBLs.
Reshaping a 2D array to 1D before removing zeroes is pretty pointless because a 2D output cannot be recovered. A more interesting scenario would be to remove some columns or rows (e.g. that are all zeroes) from a 2D array.
You should also clean up the front panel, e.g. properly zero the upper left corner, make the controls/indicators nicely labeled, sized and arranged, and maybe even add scrollbars to the arrays.
Thank you for those comments.
Now the input and output are defined (in the updated attachments) for use as example subVI's.  I also cleaned up a few visual details, but I leave the rest for others to cater to their specific uses if they don't want to use this as a subVI (or at least as-is), such as changing the icons or changing to integers instead of doubles.
I'm not sure about what you mean exactly with "=0" being "potentially dangerous with DBLs".  I'm guessing you had a certain case scenario in mind.  Although the subVI's seem to work fine within my larger program and situation, my situation may not generalize with regards to this point.
I reshaped from 2D to 1D, with a 1D output, because it could be helpful for things like when later processing just needs a 1D array.  For example, in my situation I had to remove a huge spike of unnecessary "0"'s from a previous subVI that were affecting the output display of a certain histogram.  So it turned out a 1D array output was helpful, and you never know what problems come up, so I included the 2nd example.
Hopefully if someone is looking for this, they can just use or play with an example subVI (granted that they know how to plug things in for their context).  I was hoping to post a subVI people could put to direct use.

Similar Messages

  • Removing zeros from data stream

    Hi
    I have incoming data (plz see attached diagram which shows the 2 states of the for loop '0' and default) which is a 1-D array of 64 bit real data .....it goes through the loop which removes zeros from the array.
    As I have 3 elements in the 1-D array (call them x,y,z ), the loop works very well for all values of 'y' and 'z' .
    However when x gets towards 1 and below say 10e-3 (it never is a negative number), the loop is rounding everything to 1 and then when the value gets between 1 and 0 (10e-3 for example) the loop leaves it out altogether and I just get y,z  values saved.
    Plz help me sort this out .
    Cheers
    Baz
    Attachments:
    zeros.PNG ‏25 KB
    zeros.PNG ‏25 KB

    If you want a tolerance comparison, try the attached VI.  I rewrote it from one in vi.lib after an earlier post.
    This account is no longer active. Contact ShadesOfGray for current posts and information.
    Attachments:
    CheckForEquality(DBL).vi ‏23 KB

  • Remove zeros from right side

    Hi all,
    I want to remove zeros from right side.
    like : if value is '0.055500000000E+04'.
    then the output should be '0.0555'.
    How can i get such output.
    Plz help me....

    Hi,
    the problem here is u are dealing with a datatype of format F (i.e floating point ) and the output u desire is in packed format .
    You cannot delete the zeros of such data typesas type F instead u can move them to the packed datatype and get the result.
    do one thing declare a variable of type p and move the value of type f which u have right now to the variable u have declared as type p.
    data : v_val type p decimals 4.
    v_val  =  "               <------ assign the type f to type p over here .
    hope this helps .
    regards,
    vijay.

  • How to eliminate the thumbnail picture from a .TIFF picture?

    I apologize but could not think of a more suitable forum to ask the question - if someone has an idea for a better place, I will appreciate.
    When I create a picture with my (Nikon) camera in the TIFF format, it appears that the picture file contains in addition to the full blown picture, a reduced version of the picture, something like a large thumbnail vrsion of the picture. I found it by trying to create a PDF file of the .TIFF file - Acrobat created a two page file, one with the full picture and one with the reduced picture. It looks that I can't tell the camera not to embbed the thumbnail version.
    So my question is, from someone who is familiar with the .TIFF file format, how to eliminate that thumbnail version from the .TIFF file. Must be somewhere (hopfully one) location in the file that when modifying it it eliminates the thumbnail picture from Acrobat's view into the .TIFF file.
    As to the question why not simply erase that undesired page from the PDF file - the answer is that I actually going to assemble many (hundreds) such pictures into one PDF file. Acrobat will put all those pictures such that each main picture will be followed by its own thumbnail and therefore I will have to select manually each single thumbnail page before erasing them, extremely tedious. If I could process it at the individual .TIFF file as describrd above, I could easily write a program that does this modification to all my .TIFF files with one invokation.
    Many thanks,
    David

    Try ExifTool
    http://www.sno.phy.queensu.ca/~phil/exiftool/

  • I see this was not answered or any info on the web site so I will ask again "How do I completely remove CC from my computer"

    I see this was not answered or any info on the web site so I will ask again "How do I completely remove CC from my computer"?
    And don't talk about CC cleaner.
    Howard

    Removing and reinstalling iTunes, QuickTime, and other software components for Windows Vista or Windows 7
    http://support.apple.com/kb/HT1923

  • How can I permanently remove apps from my ipad, iphone and ipod (which are in icloud)?

    How can I permanently remove apps from my iphone, ipad, ipod operating in the iCloud?

    Apps don't operate in the cloud - they're either downloaded to your device, or they're in your Purchased list. You can't permanently remove the history of apps you've purchased, but you can hide them. See this link:
    http://support.apple.com/kb/HT4919
    Matt

  • How can I completely remove iMessage from a iPad?

    Sorry I posted this a minute ago but I am not sure it did go through.  Let me post another one here...
    How can I completely remove iMessage from a iPad?  I know how to turn off iMessage on settings but I don't want the iPad to know my iPhone number at all.  How?  Thanks!  Jay

    jay.song wrote:
    Sorry I posted this a minute ago but I am not sure it did go through.  Let me post another one here...
    How can I completely remove iMessage from a iPad?  I know how to turn off iMessage on settings but I don't want the iPad to know my iPhone number at all.  How?  Thanks!  Jay
    Other post is here:
    How can I completely remove iMessage from a iPad (generation 2)?

  • How can I completely remove iMessage from a iPad (generation 2)?

    How can I completely remove iMessage from a iPad (generation 2)?  I know how to turn off iMessage on the iPad but I don't want this iPad to know my iPhone number at all.  Thanks.

    You can't. Default Apple Apps cannot be removed. If you sign out of your Apple Id in Settings->Messages->Send & Receive->Apple ID then the iPad will have no knowledge of your Phone number.

  • How do I completely remove Lightroom from my iMac?

    How do I completely remove Lightroom from my iMac?

    Hi,
    Do you mean you would like to remove Azure Backup Agent?
    If so you can remove it in Control Panel:
    Press the Windows logo key + Q to open the Apps menu, and then click Control Panel.
    Under the Programs item, click Uninstall a program.
    In Uninstall or change a program, click Azure Backup Agent.
    Please remember to mark the replies as answers if they help and un-mark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • How to Add and Remove Apps from Launchpad?

    I have noticed that I have apps missing in launchpad that I do have in my apps folder.
    How do I add these to launchpad.
    On the flip side, then how can I remove apps from launchpad that I hardly ever use?

    Did you check the second page of Launchpad?
    Click the second white dot in the bottom middle of the Launchpad screen.
    Hope  information from these articles helps.
    http://support.apple.com/kb/PH4524
    http://www.macobserver.com/tmo/article/how_to_get_the_most_from_the_macs_launchp ad
    Best.

  • How do i completely remove headers from email messages

    Hi everyone. Can someone tell me how to completely remove the headers from showing up in messages i send, forward or receive? I know how to make the headers shorter, but that's not what i want to do. I want to completely remove them from all outgoing and incoming messages. Thanks!

    Hi lpagillo.
    Not sure what you mean. You cannot remove the headers from the messages themselves. If what you want is them to not show up so that they don’t take up space on the screen, choose None in Preferences > Viewing > Show header detail.

  • How the **** do you remove bookmarks from the bookmarks toolbar?

    I have just sat down for one hour to remove bookmarks from bookmarks toolbar - very easy to add more impossible in my case to remove them

    thank you so much after trying to find out how to do it for over an hour you solved it in a few seconds ........ thank you not so mad madperson

  • How do u remove something from an array (char)

    (sorry im have just started to learn java.)
    if (Character.isWhitespace(inputTextArray[inputTextArray.length - 1]))
    inputTextArray[inputTextArray.length - 1] = null;
    how can i remove the value out of the position of the array im in.

    Once you've created an array, its size is fixed forever, so you cannot remove elements from it.
    What you will need to do is to construct a new array that contains the same text, but with the white space ommitted. Since you won't know how big the new array is until you've gone through the first one, you need something whose size is not fixed at the beginning.
    Given that you're dealing with text, I'd suggest you take a look at StringBuffer.
    Sylvia.

  • How can i update/Remove Items from AR Invoice using SDK?

    Hi All,
    I have 1 problem with update or remove item from sales order. here is the source code of mine.
    If inv.GetByKey(DocumentNumber) = True Then
                        inv.CardCode = cardcode
                        Dim ercode As Integer
                        Dim ind As Integer = 1
                        For Each drow As DataGridViewRow In gv.Rows
                            If gv.Rows.Count = ind Then Exit For
                            ercode = drow.Cells("No").Value
                            inv.Lines.SetCurrentLine(ercode)
                            'inv.Lines.ItemCode = drow.Cells("itemcode").Value
                            'inv.Lines.ItemDescription = drow.Cells("itemname").Value
                            inv.Lines.Quantity = drow.Cells("qty").Value
                            inv.Lines.Price = drow.Cells("price").Value
                            ind = ind + 1
                        Next
                        errorcode = inv.Update
                        If errorcode <> 0 Then
                            PublicVariable.oCompany.GetLastError(errorcode, errorsms)
                        Else
                            errorcode = 0
                        End If
                    Else
                        errorsms = "Not found Invoice Document Number"
    End If
    After update, it error "[INV1.Quantity][line:1],'Field cannot be updated (ODBC -1029)'"
    Does anybody know about this?
    Thanks
    TONY

    Hi $riniva$ Rachumallu,
    This is my mistake that not test manually in application.
    Thanks
    TONY

  • How do I completely remove Bing from Safari

    I have tried to remove Bing from Safari by doing the following:
    1) Checked that default search enging is google
    2) Turned off extensions (and deleted install.mac extension)
    3) Searched fo Bing in finder without success
    All the discussion suggestions complete the steps above, but they have not worked for me. I'd really like to stick with Google and dont really want to try other search engines
    Kind regards

    Look to the right of Safari's address window.  You should have a search engine window.  Click on the SE icon inside the window & select Manage Search Engines.

Maybe you are looking for