Clear an array after test

Hi all
I've just been busy with a vi, and have worked out a way to test between two arrays, and output the missing numbers from the first array compared to the second. I take these numbers from two lists in separate text files. These lists are placed in arrays, and then compared against each other. The problem im dealing with is that after Labview has run once, it stores the values last collected, and places teh next ones on top of the previous, and therefore the arrays get bigger and bigger and bigger. I need the arrays to run once, clear, and then be able to run again giving new results. The difficulty is the text files will be changing all the time from an outside code, and the output array needs to keep up to date with the input arrays. This is my code so far.
Thanks so much
Jingles
Solved!
Go to Solution.
Attachments:
Testarrayfiles.vi ‏15 KB

As Jeff already hinted, your code is very convoluted for such a simple taks and also thrashes the memory. Try to find an "in place" solution.
Why is there a representation mismatch at the end? Since you are reading and keeping only the integer parts, it seems useless to carry out the entire thing with DBL types.
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • Intermittent problem using "invoke node - reinitialization to default" command to clear an array

    I use the "reinitalization to default" invoke node to clear an array after sending the data to a file. The next time the vi is called the array should appear with all elements set at the default values. However occasionally the array will not be cleared and data from the previous time the vi was called is still in the arrary, or at least it appears that way since the same data for the previous time called appear in the file  when the new values are appended to the file. New data appears okay, only data points in the array which I dont update appear with the old values. And again it's an intermittent problem. I can fix the problem for a while anyway by shutting down labview and rerunning it.  Any ideas what's going on?
    Thank you.
    Chuck
    Solved!
    Go to Solution.

    A lot of this code should be done different, just for the reason that it is difficult to find such problems. I would suggest you browse examples about state machines to see some 'best practices'.
    But I guess I found the source of your error for now: I checked the control labled '1' which is used to build your appended array. Here I didn't find any initialization code or invoke node. Maybe that's it?
    Felix
    www.aescusoft.de
    My latest community nugget on producer/consumer design
    My current blog: A journey through uml

  • Strategy for array of tests on front panel

    I'm building a test program that has a lot of tests. The basic strategy
    that I'm trying is to have an array of tests on the front panel which would
    have an on/off button, result, spec, and pass/fail indicator showing. The
    array would also have all other information needed for that test hidden.
    This array gets indexed into a for loop that does all the tests. So the
    elements of the array are used in a lot of sub-vi's. The problem is how do
    I handle changes to the format of the element during the programming
    process? I keep finding things I need to add to the element that I didnt
    think of before. When I first started the project my idea was to make a
    custom variable of that element so that when I made a change
    it would update
    all at once. The problem with that is the array in the main vi loses the
    information it's storing when its elements update from the custom control.
    Then I'd have to retype everything back in. So I quit using a custom
    control and now when I make a change to the format of the element I need to
    copy the array/element onto all subvi's that use it. Comments?

    Isn't humorous how simple projects can turn into monsters? I will suggest an answer to the question/problem of "loosing information stored upon updating your elements in the array".
    As long as you are in development mode, you may find it helpful to spend a few minutes and build a VI (Write/Read to/from files VIs) that records the information/data for quick uploading after you update your code. Another option (if you only need the last set of values) is setting the last values to Default (use property nodes). I don't believe shift registers will fully handle your situation. Just some ideas to jog you along - Good Luck - Doug

  • Trying to clear an array inside a case structure

    Good morning all.  I am trying (unsuccessfully, obviously) to clear an array inside a case structure.  (See case structure at right side of vi, I colored it green to make it easy to find).  Here's (briefly) what I'm trying to do.  I have 6 test probes in the process.  All six probes are connected to the Alcatel Detector through a 6-solenoid manifold.  As I run the test, I want to sample 1/second, for let's say 3 minutes.  For the first 30 seconds, I want to pull a sample from from probe 1, so I turn on solenoid one and leave it open for 30 seconds.  Now all 30 values are tagged as having come from Probe 1, and they're stored in array 1.  I can now compute an average value for probe 1. Then I close solenoid 1 and open solenoid 2, saving the next 30 values to array 2.  (and so-on, until I have measured all 6 probes for 30 seconds each).  Then I wait a pre-determined amount of time and repeat the process.  Here's my problem.  I want to clear out each array as I begin the second iteration, so that I can easily compute the average of the last 30 values.  If I initialize the array by connecting a constant 0 to the shift register on the for loop insid ethe case structure, it does not work, nor does it work to place the 0 outide the overall for loop (the next for loop going out, NOT the OVERALL for loop).  I know my programming skills are still crude, but I'm putting everything into this.  Anyone have any suggestions? 
    Attachments:
    HCMF rev 1 25 Apr.vi ‏485 KB

    Altenbach, I definately understand your approach, and I like it much better than my own.  But I still have no luck making it work.   I get the same result as before (my original attempt).  Value 0 of the array simply changes each iteration, with nothing "saved".  Each new value simply overwrites the last value.  Can you take a look at my new vi, with changes, and see if you can find the error of my ways.  I am but a rookie Jedi in the vast reaches of LabVIEW Space, and you are no doubt a Jedi MASTER
    Attachments:
    HCMF rev 1 25 Apr pm.vi ‏374 KB

  • Problem after testing 100 products

    I use Labview to control a test machine. There is an 6251-M series DAQ board for analog signals to be acquired and PCI 6509 for Digital I/Os. I also control an AC motor drive via serial port(Enable, start, stop and speed ref.). The problem is after testing an amount of products(e.g. 100) the cycle time of the test increases(from 10sec to 20-30-50sec). I saw that this caused of misreadings from serial port(because I read the speed via serial port to switch between steps). Why it doesn't happen at first and starts after making an amount of tests. What can I do about this. How can I make sure the readings to be the same everytime? And make the cycle time fixed.

    MSARIKOC wrote:
    I use Labview to control a test machine. There is an 6251-M series DAQ board for analog signals to be acquired and PCI 6509 for Digital I/Os. I also control an AC motor drive via serial port(Enable, start, stop and speed ref.). The problem is after testing an amount of products(e.g. 100) the cycle time of the test increases(from 10sec to 20-30-50sec). I saw that this caused of misreadings from serial port(because I read the speed via serial port to switch between steps). Why it doesn't happen at first and starts after making an amount of tests. What can I do about this. How can I make sure the readings to be the same everytime? And make the cycle time fixed.
    Maybe a memory leak?
    Opening ressources (References and not closing them?
    Creating a report string or logstring or log-array?
    Greetings from Germany!
    Uwe

  • Waveform Graphs: Is there a way to save data to a file and then clear the graph after each run?

    This is just an added feature that I would like to insert because I end up having to erase the previous graph(for viewing and simplification purposes) after almost every plot cycle. Does LabVIEW 7.0 have a built-in feature that allows the user to automatically clear the graph after each run.
    Thank you,
    Keith Blackwell

    May I recall you that to clear a graph you have to create a property node,
    choose value and connect an 1D array with its first value to zero.
    Then using a Select vi enables you to choose from clear or graph value.
    Gérard
    Gérard Férini
    Switzerland
    http://home.tiscalinet.ch/gferini/
    remove -move to reply personally
    "Greg McKaskle" wrote in message
    news:xEmJc.43762$[email protected]..
    > > I went into the function pallette-->signal manipulation-->align and
    > > resample
    > >
    > > and found something that may be useful, but I'm not sure how to use
    > > it. I guess I have to play around with it by trial and error. Was this
    > > the VI seetting that you were referring t
    o?
    > >
    >
    > The option I was talking about is for the entire VI. It resets the
    > value of all indicators prior to running. The setting is located in the
    > VI Properties dialog on the execution page I believe. In the end, there
    > are multiple ways to get this to work, and if you want just a few
    > indicators to be reset, you want to use locals or control methods, but
    > th eVI Properties is a convenient way to get all indicators cleared at
    once.
    >
    > Greg McKaskle
    >

  • Question about the Before/After/Test metadata tags

    i think that i have read all of the appropriate sections on the wiki but i am a little unclear on how/when i need to add extra info to the Before/After/Test metadata tags.
    thus far, i have not done any unit tests that require a component to be added to the display list.  i was reading the section on how to do that and i see that all of the above mentioned tags have extra info:
    [Before( async, ui )], [After( async, ui )] and [Test( async, ui )]
    what do those do and when/why do i need to use them?
    thanks
    additionally, i am trying to run this simple example derived from what's on the wiki and it always times out.
    package HM.FO.User {
    import mx.controls.Button;
    import mx.events.FlexEvent;
    import org.flexunit.Assert;
    import org.flexunit.async.Async;
    import org.fluint.uiImpersonation.UIImpersonator;
    public class UserWindowPresenterTest {
    //protected var window:UserWindow;
    protected var button:Button;
    [Before( async, ui )] public function setUp():void {
    //this.window = new UserWindow();
    this.button = new Button();
    //Async.proceedOnEvent( this, this.window, FlexEvent.CREATION_COMPLETE, 20000 );
    Async.proceedOnEvent( this, this.button, FlexEvent.CREATION_COMPLETE, 20000 );
    //UIImpersonator.addChild( this.window );
    UIImpersonator.addChild( this.button );
    [Before( async, ui )] public function tearDown():void {
    //UIImpersonator.removeChild( this.window );
    //this.window = null;
    UIImpersonator.removeChild( this.button );
    this.button = null;
    [Test( async, ui )] public function on_user_saved_clears_password_fields():void {
    // this.window.pass_txt.text = "foo";
    // this.window.pass_confirm_text.text = "bar";
    // var presenter:UserWindowPresenter = this.window.presenter as UserWindowPresenter;
    // presenter.on_user_saved( null );
    // Assert.assertNull( this.window.pass_txt.text );
    // Assert.assertNull( this.window.pass_confirm_text.text );
    Assert.assertTrue( true );

    Okay, so the async modified is used to indicate that the asynchronous statement will be used.
    There is a bit of overhead adding async to tests, so, we don't actually instantiate the code that handles Async unless the async attribute is in the Before, After or Test. If you don't place the async in these tags [Test(async)] and attempt to use the async code. Async.whatever... you will get an error.
    Regarding the ui, attribute, the same concept was intended to apply for ui elements... in other words we wouldn't build the necessary infrastructure.. that is an optimization and right now is not in play. so you will not see different behavior with or without the ui.
    If I copy your code directly from below and paste it in my environment it passes.
    Mike

  • AS3 Best way to clear an array

    What is the best way to clear an array? (performance and resources)
    array.length = 0;
    array = [];
    array.splice(0);

    that's creating a new array which is extra work, and it's adding an array to the objects that flash will gc, and that's extra work.
    assigning the length to 0 is the most efficient way to clear an array.

  • Clearing the forms after default Save Button pressed

    HI,
    in forms 6i how to clear the form after the save button is pressed, ie the form uses default menu and smart bar. the user wants to clear the form once he selects save from the menu or after pressing the save icon...
    any idea...?
    regards
    Kris

    try on-commit trigger on form level through clear_form procedure but cursor remain stay on the same record
    I think your requirement is that when user commits a record a new blank record appear so also add "create_record" procedure ;
    .but u have to apply some logic on that trigger also it ever fires when user edit/insert/delete a record and commit;
    Hope it clears now!

  • Cluster node fails after testing removing both interconnects in a two node

    Hi,
    cluster node panics and fails to join cluster after testing removing both interconnects in a two node cluster. cluster is up on one node , but the panic'ed node fails to rejoin cluster saying no sufficient quorum yet and both clinterconn failed (even after conencting the interconn). Quorum device used is a shared disk.
    Is this a bug?
    Any workaround or solution?
    Cluster is 3.2 SPARC
    Thanking you
    Ushas Symon

    Sounds like a networking problem to me. If the failed node genuinely can't communicate with the remaining node then it will not be allowed to join the cluster, hence the quorum message. I would suspect either:
    * Misconnected cables
    * A switch that has block or disabled the port
    * A failed auto-negotiation
    This is of course without knowing anything about what your network infrastructure actually is!
    Tim
    ---

  • Prefix-list; clear bgp peer-group Test soft in; no file prompt quiet

    Hello everyone,
    I have a few simple questions. Hope someone will help me   Thank you in advance.
    1) We are using prefix-set into route-maps, but how I can use a prefix-list?
    2) In classic IOS we have the command:  clear bgp peer-group Test soft in
    I don't see it in IOS-XR (Cisco IOS XR Software, Version 4.0.1):
    RP/0/RSP0/CPU0:STH02#clear bgp ipv4 unicast ?
      *                  Clear all peers and all routes from the BGP table
      A.B.C.D or X:X::X  BGP neighbor address to clear
      as                 Clear peers in a specific AS
      dampening          Clear route flap dampening information
      external           Clear all external peers
      flap-statistics    Clear flap statistics
      nexthop            Clear nexthop
      self-originated    Clear redistributed, network and aggregate routes originated here
      shutdown           Clear all peers which were shut down due to low memory
    3) In classic IOS we have the command: no file prompt quiet
    I don't see it in IOS-XR.  What is the command for IOS-XR?
    I need it for the operation like this:
    copy ftp://**:***@216.*.*.*/CUST_AS-TEST-in.prefixlist compactflash:/PrefixFilters/CUST_AS-TEST-in.prefixlist
    Wed Apr 18 12:02:00.936 UTC
    Destination filename [/compactflash:/PrefixFilters/CUST_AS-TEST-in.prefixlist]?  !!!!   I don't need this question
    Copy : Destination exists, overwrite ?[confirm]                                                   !!!!   I don't need this question
    Accessing ftp://*:*@216.*.*.*/CUST_AS-TEST-in.prefixlist
    C
    584 bytes copied in      0 sec
    Have a nice day,
    Dimitry

    Thank you Alexander for your reply. It is the good RPL description and I've got the idea of REFRESH capable peer.
    BUT, I still don't find the answer on my 3-d question:
    In classic IOS we have the command: no file prompt quiet
    I don't see it in IOS-XR.  What is the command for IOS-XR?
    I need it for the operation like this:
    copy ftp://**:***@216.*.*.*/CUST_AS-TEST-in.prefixlist compactflash:/PrefixFilters/CUST_AS-TEST-in.prefixlist
    Wed Apr 18 12:02:00.936 UTC
    Destination filename [/compactflash:/PrefixFilters/CUST_AS-TEST-in.prefixlist]?  !!!!   I don't need this question
    Copy : Destination exists, overwrite ?[confirm]                                                   !!!!   I don't need this question
    Accessing ftp://*:*@216.*.*.*/CUST_AS-TEST-in.prefixlist
    C
    584 bytes copied in      0 sec
    How can I suppress confirmations like this?
    Destination filename [/compactflash:/PrefixFilters/CUST_AS-TEST-in.prefixlist]?
    Copy : Destination exists, overwrite ?[confirm]
    Dimitry

  • CFDiv - clearing the form after submission

    I am using cfdiv with a data entry form and on submission writes the values to a db,  works great, but, how can I clear the form after submission?
    reloading the page loads it in the cfdiv.
    TIA
    Jbird

    To where are you submitting this form?  Also, are you submitting as a get or a post?

  • Passing arrays with Test Stand to DIO 96

    Does anyone know the easiest way of sending data arrays from Test Stand to a DIO 96 using a LabView dll? I have a Test Stand sequence where I will need to set bits and read bits from a DIO 96 and am going to make a LabView dll. I guess I will need to pass either arrays to and from each port or numeric data to and from each port to a dll and also figure out how the status of the bits in the DIO 96 will be remembered.
    What is the best strategy for dealing with Test Stand and a DIO 96?
    Has anyone any ideas or example code?

    Hi Steve,
       either approach is perfectly valid, and as you say, the activeX approach does remove some of the flexability of where you get the data from, however, what you've really described is two separate things, rather than two separate styles of approach.
    ActiveX or direct passing are simply the means of getting data from and to your TestStand data space.
    Step types are a convenient way of wrapping up particular layouts and functionalilty into a very easily re-usable TestStand development item. You would still need some sort of code module to put with a step type, so you're not necessarily limiting your developed code to the Teststand environment.
    Making links through ActiveX allows you to make a solid definition on configuration type items, and allow for edit substeps. For example, the NumericLimitTest step type has step.limits.high and step.limits.low. Rather than pass those to the edit substep as a dll call (which is perfectly valid), passing the sequence context (which also allows you to run the termination monitor etc) allows for the fixed references to the fixed data layout of the step. Self containment like this works when the data sources are fixed as you get with a step type to use the edit substep, or the pre/post substeps.
    Working on a dll call allows more re-use because then you concentrate on the data, rather than where it's come from, however, for large amounts of different sources, the dll prototype can become very complex and difficult to document. You end up having to pass lots of parameters and some of them you might not use.
    The question you're ultimately trying to answer is "what does it do to my architecture?"
    The holy grail of TestStand architectures is any step type can be used in any sequence in any sequence file with any process model under any operator interface. Now this isn't always practical, but the closer you get to it, the more flexibility your system as a whole contains, and the easier it becomes to add in or change the layout / functionality of the system
    With this comes code re-use, but the extra development time it takes to make good re-usable maintainable code isn't re-couped until the 4th or 5th re-use.
    If you want in this case your passing of the array to occur from many different places in your sequences, and you're building up lots of sequences to use them, then making a step type, and passing through the most convenient method you decide upon will make the implementation of the sequences easier to do.
    If you only need it in a couple of ways, then you can do without the step type, and if it's not many different data sources, then pass by parameter to the dll through the function prototype directly, and use a regular DLL adapter to acheive it.
    Mostly my 2-cents worth.
    Thanks
    Sacha Emery
    National Instruments
    // it takes almost no time to rate an answer

  • How to insert elements into an array after each iteration of a for loop

    I am new to labview and working on an application where I am supposed to store an element into an array (without overwriting) after each iteration in a for loop. I have tried using Build Array Function keeping the indicator outside the for loop and played with indexing but didn't work. Please suggest me an idea how to do it.
    Thanks
    Solved!
    Go to Solution.

    Thank you for your suggestion.Here is my actual application attached . In the first image, a difference in time is evaluated and an enum const of insert into array is passed to the shift register where it takes to Insert element into array phase (Second image). I need to enter the time difference into an array after every loop iteration. Please have a look and could you let me know where I am mislead.
    Attachments:
    Image 1.JPG ‏88 KB
    Image 2.JPG ‏71 KB

  • When I open a photo with Preview, it opens all the photos I have viewed previously.  How can I prevent that, other than manually clearing the list after each time?

    When I open a photo with Preview, it opens all the photos I have viewed previously.  How can I prevent that, other than manually clearing the list after each time?

    Close the pictures before you quit Preview. Cmd-opt-q will close all windows and quit. cmd-opt-w will close all windows and not quit.
    Or, Disable automatically opening files that were left open in General System Preferences

Maybe you are looking for

  • HP Color LaserJet 2840 misidentified as 2830

    Hello, Everyone We were having problems with our HP Color LaserJet 2840 so I took it to a local computer store for repair.  (The problems were that the printer was squeaking really bad, and tray 2 had ceased working...)  So, I got it back from the sh

  • Desktop "Change Picture" grayed out

    Before installing Tiger I was able to select "Change Picture" in System Preferences Desktop. Now that feature is grayed out, and a single picture is continuously display on the desktop. Any idea how to fix this?

  • Unable to Create New Dashboards

    Hi All, Interesting issue I ran into with today and have been unable to figure out. I didn run into this same error with the same build on another machine. I'm trying to create a new Dashboard, I've set up the RPD, updated my instanceconfig.xml and n

  • How can I select areas inside incomplete shapes?

    Hi, I'm often required to open PDF drawings outputted from AutoCAD and add colour to them. I do this by opening the PDF in Illustrator and drawing colour shapes in a layer underneath the CAD drawing. Illustrator is good at handling all of the lines f

  • How To use window.print() into Button Attributes

    hi, I want to print a report using an print button.so i am using window.print() function into Button Attributes .But Print pop up screen not pop up . How To use window.print() into Button Attributes      . Thanks Manoj