Array elements keep returning to their initial value after being replaced

Hello,
This is my first post here, but this looks like a great place to discuss labview.
I have a strange problem that probably has a simple answer.
Basically, I have initialized an array outside of a "for loop" that contains a "flat sequence structure."  I use the array inside the flat seq structure, replacing elements within the array, incrementaly by 1 starting with index 0, so i have run a wire through the "for loop" barrier and then through the "flat seq structure box".
However when I step through my VI what happens is this.
On the first run through, it succesfully changes the element at index 0.  On the next iteration it succesfully replaces the element at index 1, however, now index 0 has returned to its initial value!   .... This continues.... say im up to my 100th iteration, all the previous indexes have all returned to their initialized value but index 99 (its the 100th iteration) now has the value it should...however on the next iteration, index 99 will return to its initialized value.... its a vicious cycle..
Can anybody tell me what I've screwed up?
Thanks a Million,
Nick

Are you using a shift register on your loop or a tunnel?  If you are using a tunnel, then the orginal value is always passed into the loop.  If you use a shift register, then each iteration of the loop has the value passed in the last iteration of the loop.  I'm not at work, so can't setup a perfect example, but this is from an example I showed someone else.  The first two examples I show here are using shift registers and a 2-D array.  The second example uses an element only available in later versions of LV, but is supposed to be more efficient memory wise.

Similar Messages

  • Sysctl VM settings spontaneously return to their default values

    I am pretty clueless about this issue.
    In my workstation's /etc/sysctl.conf I have the following variables:
    vm.dirty_writeback_centisecs = 1500
    vm.laptop_mode = 5
    which are set correctly (according to /proc/sys/vm/* files) on boot. However, after some uptime (usually several days) and moderate swap activity the above settings return to their defaults, namely 500 and 0. I have to login as root and run sysctl -p, but later the situation repeats itself...
    Any ideas as to why this happens are greatly appreciated.

    Would it be possible or practical for you to use the method I described over here?
    https://social.technet.microsoft.com/Forums/en-US/52aebe59-80c9-4aac-8911-5f737e848111/unattendxml-settings-contained-within-a-revised-image?forum=mdt
    If this post is helpful please vote it as Helpful or click Mark for answer.

  • Manipulating condition value after being returned from IPC

    Hi all,
    How can we manipulate the condition rate data after the value is returned from IPC?
    We tried using CRM_PRICING_I_BADI calling the method CRM_PRICING_I_MERGE. But it did not solve the issue.
    Requirement is to read the data of a particular condition type from a preceedign document and then overwirte the conditon value of condition type in the current transaction with that old value from previous document.
    Can this be achieved without using Java coding and manipulate the value after IPC has returned the conditon value and before it is being presented on GUI?
    Please help me with your suggestions.
    Regards,
    David.

    Hello david,
    You might ned to use the user Exit provided by the Pricing Engine to work this out. this will require Java coding.
    Regards,
    Tanu

  • Does anyone have trouble connecting to their wireless network, after being logged on for some time? Mountain Lion.

    I am having trouble connecting to my wireless network.  It works when I startup my computer but, after a while it can't seem to find the wireless network. I have an Airport Extreme and the light is green. The only way to remedy this problem is to restart my computer. Mountain Lion isn't that great after all not to mention it distorts some images when scrolling. I am kindly asking for some advice, I assume a major update will be coming soon.

    You don't by chance have a "invisible" or "hidden" network enabled on the router?
    Because Mac's won't reconnect automatically now to hidden network only upon reboots, it's sort of like advertising the hidden network if you take the computer elsewhere.
    Also hidden networks are no deterrent to hackers, they see all.
    Also check your time and date, make sure they accurate first, then save that, then make sure it's updated via Apple time servers in your general location (System Preferences > Time and Date) If your being kicked off, your DCHP lease might be expiring too early.
    WiFi, Internet problems, possible solutions
    WiFi security issues, at home and WiFi hotspots

  • Type defined array of clusters for holding configuration data - setting default values for each array element

    Hi,
    I was wondering if I could get some information and opinions about using a type defined array of clusters to hold configuration data.  I am creating a program to test multiple DUTs and wanted to have a type defined control for each DUT containing the information needed to create the DAQmx tasks for all of the signals for that DUT.  I am wanting to do this so that the data is hard-coded and not in a file that the user could mess up.
    The type def controls are then put in a subVI that chooses the appropriate one based on the DUT Type enumeration wired to a case structure.  
    I am having problems with the type defined control.  I am seeing issues when attempting to save a unique configuration to each array element in the array of clusters.  Somehow it worked to begin with, but now clicking "Data Operations --> Make Current value default" on individual elements of the cluster or the entire cluster (array element) is not saving the data when I re-open the type def control.  What am I doing wrong?  Am I trying to do something with arrays of clusters that I should not be doing?
    I have attached one of the type defined controls for reference.  I tried changing it to Strict to see if that helped, but no luck.
    To reproduce, change the resource string for array element 0 and make the new value the default value.  Then close the type def, and re-open it.  The old value is still present in that element.  The VI is saved in LabVIEW 2012.
    Solved!
    Go to Solution.
    Attachments:
    CM_AnalogInputs.ctl ‏11 KB

    Values of a typedef are not proprigated to instances of the control. THey will pick it up if created AFTER the data values have been changed. THey will not get updated with future changes. You should either create a VI specifically for hardcoding your values or implement a file based initialization. The file based would be much better and more flexible. If you don't want users to modify the data simply encrypt it. There is a noce blowfish library you can download.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • FINDING MEDIAN FOR AN ARRAY OF INTS WITH EVEN NUMBER OF VALUES

    okie dokie fellas i know this has got to be easy but i hjave been sittin at my comp forever workin on projects that are due and my head isn't all there anymore...could someone please clue me in on how im supposed to write the logic to find the median of an array of integers if the array contains an even number of values...I know I have to average the 2 values on either side but i cant figure it out at all...sorry i know its dumb but thnaks to anyone who helps
    package pgm3deClercqMatt;
    * @author Owner
    * To change the template for this generated type comment go to
    * Window>Preferences>Java>Code Generation>Code and Comments
    import java.sql.*;
    import javax.swing.*;
    import java.awt.*;
    import java.util.*;
    import java.text.*;
    public class ExamStatistics
         public static void main(String[] args)
              DbConnection db = new DbConnection("pgm3");
              boolean moreRecords;
              String query = "SELECT * FROM pgm3Data ORDER BY ExamGrade";
              ResultSet rs = db.processQuery(query);
              int nbrGrades = 0;
              ResultSetMetaData rsmd = null;
              try
                   rsmd = rs.getMetaData();
              catch(SQLException sqlex)
                   JOptionPane.showMessageDialog(null, "SQLException getting ResultSet data or metadata");
                   System.exit(0);
              int s[] = new int[200];
              DecimalFormat decimal = new DecimalFormat("#,##0.00");
              int n = 0, aboveNinety = 0, numberAboveNinety = 0;
              double sum = 0, avgGrade = 0, medianGrade = 0;
              try
                   moreRecords = rs.next();
                   if(!moreRecords)
                        JOptionPane.showMessageDialog(null, "pgm3Data Result Set is Empty.");
                        System.exit(0);
                   while(moreRecords)
                        s[n] = rs.getInt(1);
                        n++;
                        moreRecords = rs.next();
                   }// end of while loop
                   System.out.println("n = " + n);
                   System.out.println("s[0]= " + s[0]);
                   System.out.println("s[n-1]= " + s[n-1]);
                   //FIND AVERAGE OF ARRAY
                   for(int j=0; j<n; ++j)
                        sum += s[j];
                        avgGrade = sum/n;
                   //FIND NUMBER OF GRADES ABOVE OR EQUAL TO 90
                   for(int j=0; j<n; ++j)
                        if(s[j]>=90)
                             numberAboveNinety++;
                   //FIND MEDIAN EXAM GRADE
                   for(int j=0; j<n ; ++j)
                        if(Math.abs(medianGrade - Math.floor(medianGrade))<1.e-10)
                              medianGrade = s[(j+1)/2];
                        else
                             medianGrade =    <HERE IS WHERE THE PROB IS
              }// end of try block
              catch(SQLException sqlex)
                   JOptionPane.showMessageDialog(null, " SQLException getting ResultSet data or metadata");
                   System.exit(0);
              String output = "";
              output = "Number of Exam Grades: " + n;
              output += "\nHighest Exam Grade: " + maxOfArray(s, n) + "\nLowest Exam Grade: " + minOfArray(s, n)
                        + "\nAverage Grade: " + decimal.format(avgGrade) + "\nNumber of exam grades above 90: "
                        + numberAboveNinety + "\nMedian Exam Grade: " + medianGrade;
              JOptionPane.showMessageDialog(null, output);
              System.exit(0);
         }// end of main
         static int maxOfArray(int z[], int n)
              int j, max = z[0];
              for(j=1; j<n; ++j)
                   if(z[j]>max)
                        max = z[j];     
              return max;
         static int minOfArray(int z[], int n)
              int j, min = z[0];
              for(j=1; j<n; ++j)
                   if(z[j]<min)
                        min = z[j];     
              return min;
    }// end of ExamStatistics
    class DbConnection
         //     class DbConnection creates and manages the db connection,
         //     processes queries, and returns result sets for processing
         private Connection connection = null;
         private String url="jdbc:odbc:";
         private Statement statement;
         private String username = "";
         private String password = "";
         private ResultSet rs;
         private int nbrResultSets = 0;
         //     Constructor Argument is the registered name of the database
         DbConnection(String dbName)
              try
              {// load driver to allow connection to database
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   connection = DriverManager.getConnection ((url+dbName), username, password );
              catch (ClassNotFoundException cnfex)
                   fatalError("ClassNotFoundException on connection attempt");
                   System.exit(0);
              catch (SQLException sqlex )
                   fatalError("SQLException -- Unable to Connect to db");
                   System.exit(0);
         } // end of constructor
         ResultSet processQuery(String query)
         //     process a single SQL query and return the resulting data set
              rs = null;
              try
                   statement = connection.createStatement();
                   rs = statement.executeQuery(query);
              catch (SQLException sqlex)
                   fatalError("SQLException on query or processing");
              return rs;
         void endConnection()
              try
                   connection.close();
              catch (SQLException e)
                   fatalError("SQLException on attempt to close connection");
         //     simple local fatal error handler
         private void fatalError(String msg)
              JOptionPane.showMessageDialog(null,msg);
              System.exit(0);
    } // end of class DbConnection

    sorry to anyone who thinks what i'm doing is a joke
    first of all i'm a student and secondly i'm taking
    java in a summer session so things don't get
    explained as well as they should. And how is this our problem?
    I'm doing the best
    i can. The for loop was because the array that I
    defined to hold 200 values was being filled by a
    database with a supposed unknown number of values but
    less than 200 so i waslooping through to get each
    value and put it in order and the conditional
    statement was supposed to test to see if the incoming
    median was an integer and was in the final write-up
    put into it's own boolean method returning false if
    there was no median and you needed to take the
    average of the next lowest and highest values. BThere's always a median. The definition I sent you tells you what it is.
    But
    thnak you very much to the people that actually help
    on here and don't try to bash people who have put
    effort into writing their code, however shitty it may
    look to them. You can't control what people say about your stuff. Everyone who criticizes your work isn't making a personal attack. They're telling you something that you should be learning from. Your problem is that you can't separate yourself from your work.
    No one knows absolutely everything and
    people who decide to talk down on others when they
    are using this forum as a last resort need to grow
    up.Grow up? That's what you need to do. If you think for a moment that you'll never be criticized once you leave that ivory tower you're sadly mistaken. You need to figure out how to separate yourself from your code.
    %

  • Setting main object property initial values before loading tile list - Agentry

    Hi;
    I am working on SAP Work Manager 6.0 customising using Agentry 6.1.3. I have 2 properties on the Main object, which are WeekStart and WeekEnd, these properties have their initial values set using a rule on the transaction property level. I am using these two properties in a tile list include rule, to only display items per week, that is if the item date is between WeekStart and WeekEnd. Now my issue is when the tile list initially loads items, the action containing the transaction to set values for WeekStart and WeekEnd has not been executed yet, and hence at this point the tile list is empty. At what point could I run this action to set the initial values of WeekStart and WeekEnd? Currently when the tile list loads, nothing is displayed because the dates sitting in WeekStart and WeekEnd are invalid yet, they have not been set by the transaction. My current include rule is as follows:
    Your help is very much appreciated!
    Thanks and Regards;
    Sizo Ndlovu

    Hi;
    I really thought that putting the action on "Succesful Login Action" would deal with this issue, please see screenshot below:
    But I see that this does not get executed on the initial load?!
    Any suggestions would be appreciated!
    Thanks and Regards;
    Sizo Ndlovu

  • Initialized values for Init blocks disappear at random

    Hi everyone
    I have a strange scenario and would appreciate your help with some ideas on how to troubleshoot this.
    We have OBIEE 10.1.3.4. It is a BI Apps 7.9.6.1 environment and OBIEE is integrated with EBS. Everything is working 100% fine and all initialiation blocks are initialized succesfully. Now iit has happened a couple of times that the init blocks seems to "lose" their initialized values. For example, CURRENT_FISCAL_YEAR will be initialized to 2011. Then out of the blue, next time you log in this init block has the value of 2008, which is the default initializer. The servers are all up and there are no errors.
    Any ideas about what is going on here?
    Thank you

    Check the SQL query in init block.It will take default value if SQL query does not fetch any record.
    I guess you have created a repository variable.
    Regards,
    Sandeep

  • Put ibrowser to his initial value

    hello to all, first i want to say im sorry because i know that the majority of my questions arent very related with Mii, then i have more one question...after insert the information in the DB i want that my dropboxes return to is initial values that is - - - , i already tried this: document.brs_Tare.updateBrowser(true)...and worked but then for example the user could choose the data to insert in dropbox 2 before choose the data in dropbox 1 and i dont want that...
    regards and thanks in advance
    Mário

    Mário,
    If you dont want the user to choose drop Box 2 before selecting the data in Drop Box 1, then use
    <Param name="initialUpdate" Value="false">
    for Drop Box 2. Activate it only on selection event  of DropBox 1.
    document.brs_Tare.updateBrowser(true) is the best option.If you just want ur iBrowser to return to initial value  use
    document.brs_Tare.setSelectedItemByIndex(0)
    or use
    document.brs_Tare.setSelectedItem('----')
    Hope this help
    Regards
    Muzammil

  • Multi-state object return from visible to invisible after a few seconds?

    Hi Community,
    I have a folio for ipad. on the second page is a picture of a technological product. i made several info buttons on top of it that open a descriptionbox for the specific area of the product via MSO.
    Is it possible to let MSOs return to their invisible state after a few seconds? I tried the timing option, but that didn't worked out. the object returned to invisible immediatly. not after the set timeframe of 3 seconds.
    my only solution was to make extra close buttons for each MSO to return to invisible state. but that leaves the Infotext boxes open all the time unless you close them manually.
    another idea was to make each info button close every other infobox. but that is messy and didn't work very well on the first attempt. and still leaves one infobox open all the time.
    PS: sorry if unclear, for typos and language. Not native.
    Hendrik

    there is no way to automatically close an MSO n seconds after it was manually opened by the reader.
    yet...
    but thanks anyway

  • How do you subtract different values for specific array elements?

    Hi LabVIEW Community,
    I am new to LabVIEW and Im working on my first application. One of my challenges that I am having problems solving is how to  subtract specific values from specific elements in an array.
    My aplication is to measure the distance between a sensor and a magnet, however the initial distance for each sensor  to magnet is different. I have converted the voltage to a distance using the Math Node for each element and now need to  correct these values by subtracting their individual initial value.
    The source is a 1D array of DBL64  consisting of 32 elements and each of these values needs to have a different value subtracted.
    eg:
    Element 1 - 5.557
    element 2  - 2,34
    element 3 - 7,654  and so on
    I have tried to seperate (index the array) and subtract the values from each element and then combine them again. This has not been effetive. I need to write these values to an .txt file and also use them in another calculation.
    I have attached my attemted sub VI.
    Any advise would be really apprecieated.
    Solved!
    Go to Solution.
    Attachments:
    Sub VI Split Array_Correct Distance.vi ‏36 KB

    You don't need to overthink it. There's a really simple method. Generate an array that contains all your offsets you want.  Then subtract it off.
    It's the same VI with this change:
    Attachments:
    Sub VI Split Array_Correct Distance_LV12_MOD.vi ‏24 KB

  • How to set the value of an array element (not the complete array) by using a reference?

    My situation is that I have an array of clusters on the front panel. Each element is used for a particular test setup, so if the array size is three, it means we have three identical test setups that can be used. The cluster contains two string controls and a button: 'device ID' string, 'start' button and 'status' string.
    In order to keep the diagrams simple, I would like to use a reference to the array as input into a subvi. This subvi will then modify a particular element in the array (i.e. set the 'status' string).
    The first problem I encounter is that I can not select an array element to write to by using the reference. I have tried setting the 'Selection s
    tart[]' and 'Selection size[]' properties and then querying the 'Array element' to get the proper element.
    If I do this, the VI always seems to write to the element which the user has selected (i.e. the element that contains the cursor) instead of the one I am trying to select. I also have not found any other possible use for the 'Selection' properties, so I wonder if I am doing something wrong.
    Of course I can use the 'value' property to get all elements, and then use the replace array element with an index value, but this defeats the purpose of leaving all other elements untouched.
    I had hoped to use this method specifically to avoid overwriting other array elements (such as happens with the replace array element) because the user might be modifying the second array element while I want to modify the first.
    My current solution is to split the array into two arrays: one control and one indicator (I guess that's really how it should be done ;-) but I'd still like to know ho
    w to change a single element in an array without affecting the others by using a reference in case I can use it elsewhere.

    > My situation is that I have an array of clusters on the front panel.
    > Each element is used for a particular test setup, so if the array size
    > is three, it means we have three identical test setups that can be
    > used. The cluster contains two string controls and a button: 'device
    > ID' string, 'start' button and 'status' string.
    >
    > In order to keep the diagrams simple, I would like to use a reference
    > to the array as input into a subvi. This subvi will then modify a
    > particular element in the array (i.e. set the 'status' string).
    >
    It isn't possible to get a reference to a particular element within an
    array. There is only one reference to the one control that represents
    all elements in the array.
    While it may seem better to use references to update
    an element within
    an array, it shouldn't really be necessary, and it can also lead to
    race conditions. If you write to an element that has the
    possibility of the user changing, whether you write with a local, a
    reference, or any other means, there is a race condition between the
    diagram and the user. LV will help with this to a certain extent,
    especially for controls that take awhile to edit like ones that use
    the keyboard. In these cases, if the user has already started entering
    text, it will not be overwritten by the new value unless the key focus
    is taken away from the control first. It is similar when moving a slider
    or other value changes using the mouse. LV will write to the other values,
    but will not rip the slider out of the user's hand.
    To completely avoid race conditions, you can split the array into user
    fields and indicators that are located underneath them. Or, if some
    controls act as both, you can do like Excel. You don't directly type
    into the cell. You choose w
    hich cell to edit, but you modify another
    location. When the edit is completed, it is incorporated into the
    display so that it is never lost.
    Greg McKaskle

  • I need sorting VI that returns the sorted array element's positions in the unsorted array

    I need a VI that will very quickly (n log n) sort a 1D array of doubles.  This VI should not only output the sorted array, but for each of the sorted array elements, it should also output that sorted array element's position in the unsorted array.  So for example if the input array were:
    unsorted_array
    4.1
    2.3
    7.0
    5.6
    10.2
    Then the output arrays would be:
    sorted_array
    2.3
    4.1
    5.6
    7.0
    10.2
    indices_array
    1 (the value 2.3 is located at position 1 in the unsorted_array)
    0 (the value 4.1 is located at position 0 in the unsorted_array)
    3 (the value 5.6 is located at position 3 in the unsorted_array)
    2 (the value 7.0 is located at position 2 in the unsorted_array)
    4 (the value 10.2 is located at position 4 in the unsorted_array)
    This way I could generate the sorted_array using just the indices_array and the unsorted_array.  Has anyone written a nifty piece of code to do this?  I did some research on (n log n) sorting algorithms but most of them use recursion which I don't know how to do in LabVIEW.  It would also be nice to have an algorithm like this that could sort an array of strings.
    cheers,
    Richard

    Try something like the attached example (LabVIEW 7.0). I think it does what you need.
    (To understand the code, it is important to know that arrays of clusters are sorted by the first element in the cluster).
    Sort array itself sorts also array of strings, so you could just substitute, keeping the rest of the code the same.
    Sort array uses a variation of quicksort, so it should have about NlogN complexity.
    (If you think you only need the array of indices to later generate the sorted array, it does not make much sense to even do it. To get the indices, you need to sort the array anyway. You should just sort the plain array directly.
    Message Edited by altenbach on 07-13-2005 03:47 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    SortAndIndex.vi ‏26 KB

  • How to Return the Index of a Mouse-Selected Array Element in the View Interface of Diadem

    Hello,
    Does anybody have an idea of how to obtain the index of a mouse-selected array element in the View interface of Diadem??
    Thanks!

    Hi Ovidius,
    Keep explaining.  The only way I know of to trap a selected cell value in VIEW is to embed into the desired VIEW area a second non-modal SUDialog that has a Table control or an XTable control displaying the values of certain data channels.  There are callbacks in both table controls for cell selection, and you can configure the table control to allow only single cell selection if that's what you want.  The regular table control will be easier to program, but the XTable control will perform much better for larger channels.
    But what happens with that value the user selected?  Is it used for a calculation?  Is it added to a report?  Why would the user select that cell in a table rather than selecting the corresponding feature in a graph with the crosshair cursor?
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • What is reason for cl_fpm_factory= get_instance( ) return initial value?

    In DEV system, this piece of code is working fine. However when it moves to Testing system it dump due to cl_fpm_factory=>get_instance( ) return initial value. What could be the reason for this? Thanks!
      data lo_fpm  type ref to if_fpm.
      lo_fpm = cl_fpm_factory=>get_instance( ).
      wd_this->go_message_manager = lo_fpm->mo_message_manager.

    Hi Anthony,
    how sure are you that the DEV and Test system running the same Netweaver SP versions ?.  My doubt is that the test system is not NW7.01 (Ehp-1) . Or some thigs are not enabled in the configuration.
    Regards
    Senthi

Maybe you are looking for