Comparison of values in an array

Hi,
So, I have an array comprising of 16 values, and I would like to compare the first 14 values (using the Array Subset vi) of the array, and when they are all within a specific distance of each other, start a timer.
Since we are measuring temperature with each one of these inputs in this array, once, and only once, they elevate past about 100 degrees Celsius, I would like to start comparing them amonst each other. Once they all are within 20 degrees celsius of each other, this timer should start. I already have the timer set-up, but I'm missing this comparison.
I'm really new to Labview, so the only way I can think of right now, would be extracting every single value, and comparing them with each other inside a while loop, but there has to be a better way, right?
Thanks in advance!
Solved!
Go to Solution.

Hi Eduardo,
the timer is not suppposed to run before those two conditions are true, and it should not stop running once they aren't true again
You have to define your logic carefully! What happens the second time the conditions become true?
Get rid of the case structure:
The timer gets resetted when both conditions become TRUE (by help of rising edge detection), else the timer just runs up...
If you really insist on "timer is not suppposed to run before those two conditions are true" you have to include some more boolean functions like here:
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome

Similar Messages

  • How to get the values of an Array using JSP Tags

    Hey guys,
    I need some help. I've splited a String using
    fn:split(String, delim) where String = "1,2,3,4" and delim is ,
    This method returns an Array of splited Strings. how do i get the values from this array using jsp tags. I don't wanna put java code to achive that.
    Any help would be highly appreciated
    Thanks

    The JSTL forEach tag.
    In fact if all you want to do is iterate over the comma separated list, the forEach tag supports that without having to use the split function.
    <c:set var="list" value="1,2,3,4"/>
    <c:forEach var="num" items="${list}">
      <c:out value="${num}"/>
    </c:forEach>The c:forTokens method will let you do this with delimiters other than a comma, but the forEach tag works well just with the comma-delimited string.

  • Get distinct values from plsql array

    Hi,
    I have declared a variable as below in plsql proc.
    type t_itemid is table of varchar2(10);
    inserted set of items in to this using a program
    now i want distinct values from that array how can i get it.

    I am using 9i so i cannot use set operator and more over my problem is that i am declaring the variable inside the plsql block . when i tried i am getting the below errors:
    SQL> r
    1 declare
    2 type t_type is table of varchar2(10);
    3 v_type t_type;
    4 begin
    5 v_type := t_type('toys','story','good','good','toys','story','dupe','dupe');
    6 for i in (select column_value from table(v_type)) loop
    7 dbms_output.put_line(i.column_value);
    8 end loop;
    9* end;
    for i in (select column_value from table(v_type)) loop
    ERROR at line 6:
    ORA-06550: line 6, column 41:
    PLS-00642: local collection types not allowed in SQL statements
    ORA-06550: line 6, column 35:
    PL/SQL: ORA-22905: cannot access rows from a non-nested table item
    ORA-06550: line 6, column 10:
    PL/SQL: SQL Statement ignored
    ORA-06550: line 7, column 22:
    PLS-00364: loop index variable 'I' use is invalid
    ORA-06550: line 7, column 1:
    PL/SQL: Statement ignored

  • How do I remove NaN values from an array?

    I'm trying to test if the values in an array are less than 0.001. All of them are...BUT the problem is that some of the elements in the array are NaN. I'd like to do one of two things:
    1. Remove the NaN elements from the array and set them to zero to make the test work.
    2. Make the test understand that NaN elements are okay.
    The test results in a boolean array of T/F values. If all of the values of the boolean array are T, it will result in a single boolean value of T. In #2, I am saying that I want it to test if an element of the array is less than 0.001 OR equal to NAN.
    Solved!
    Go to Solution.

    Your statements don't make much sense. It's irrelevant how many NaNs are in the array. A sort will move them all to the bottom. You had said you wanted to find out if all the elements in an array are less than 0.001, and that you've got some NaNs in there. Well, this will do that:
    twolfe13 wrote:
     I did see how to remove NaN once, but couldn't determine a good way to generalize it other than doing a test loop. I thought there might have been a simple function that I overlooked to do this.
    As I noted, there have been several posts in the past about efficient techniques for removing certain elements out of an array. Seek, and ye shall find.
    Joseph Loo wrote:
    Have you look at the coerce function where you can set the lower and upper limit?
    That won't do anything for NaN. Or perhaps I misunderstood what you are suggesting to do?
    Attachments:
    NaN sort.png ‏20 KB
    NaN sort small.png ‏5 KB

  • Using DMA to update values in an array

    Good afternoon, 
    I've been running into a few problems with my vi, and I'd like to give a bit of the background information before I ask my questions. I'm using Labview 8.5 and the NI USB-6009 DAQ. I want to use an encoder to control values that are being written to a file for DMA. I found that I couldn't use the encoder as an external clock since the 6009 DAQ doesn't have this capability. So I've been trying to go a differenet route by using a case structure with a True/false statement to allow me to input values from a simulated signal into a write vi (each time the encoder pulses, a value from the simulated signal should be inputed into the write data storage vi). From there, I want to then read those values and put them into an array. So the plan is to have a 10 element array that reads in values from the storage file (just like in FIFO for FPGA). As I continue reading values, the oldest value of the 10 element array will leave the array and be replaced by a new value. 
     Now here come the questions, I'm using the Write/Read data storage vi's and I keep getting errors. First, if I'm wanting to use DMA to read these values am I using the correct vi's, or is there a different route? Also, once I read these values into the array how would I be able to constantly update the array in a descending order from begining to end of the stored values? 
    I'm posting my most recent vi that I've been editing. Also, in advance, thank you!
    -tjm
    Attachments:
    Using Encoder as an analog input 10_9_13 - Copy - Copy.vi ‏390 KB

    Thank you for your reply.
    First, I'm ultimately trying to use the array as input into a visual display for a meter (to display the mean of the array). I've been successful (in the past) with inputting into an array by not using DMA and using the Sort 1D Array point by point vi. The only problem is the timing mechanism with the encoder, and you are correct with stating that there is uncertainty with the encoder when trying to retrieve values from the input signal (sine wave). I thought about going down the route of using the encoder as a counter (since I am able to see the counter increase by a single digit with each pulse).
    My question would then be how to control the case structure with a counter input? 
    I'm posting both my setup with the Sort 1D Array Point by Point and the simple vi for the encoder as a counter. My idea is to try to merge the two and have the counter control the case structure. 
    Is there a way I can do this? 
    Attachments:
    Sort 1D Array Pt by Pt.vi ‏189 KB
    Using Encoder as a counter input 10_9_13.vi ‏123 KB

  • How to take a field value in an array?

    how to take a field value in an array? its urgent........

    yaa... i know,  but actually we need to  multiply that number with some digit.
    take it this is way, if  i push it into another array, we have an array of digits but what i need is a all digit to be together to be multiplied to a number
    for example -
    if i push the numbers into new array say arr[];
    so i will have something like this. arr[1,2,3,4,5,6.......]  
    but i need  the new varaible should have value as 12345........   all concatenated.
    if i perform operation on array each digit will be multiplied individually.
    hope u got what m trying to sayy....
    Thanks for the prompt response..........

  • Finding a minimum value in an array without using loops

    I can find a minimum value in an array using a loop, but I am unsure of how to do it without any type of of loop
    Here is what I have using a loop:
    // This method searches for the minimum value in an array
    public static int min(int a[]){
    int min = a[0];
    for(int i = 1; i < a.length; i++){
    if(a[i] < min){
    min = a;
    return min;
    How do I covert this to do the same thing, using no loops?
    Thank you for replies
    Edited by: kazmania on Feb 7, 2008 12:26 PM

    public class Test112 {
    public int recurse(int[] x, int i, int n)
    if (i==x.length-1) { return (x[i] < n) ? x[i] : n; }
    n = (n < x[++i]) ? n : x;
    return recurse(x, i, n);
    public static void main(String[] args) {
    int[] nums = {3, 1, 56, 2, 99, 34, 5, 78, -400, 2383, 201, -9, -450};
    Test112 t = new Test112();
    int min = t.recurse(nums, 0, nums[0]);
    System.out.println(min);

  • Store XML node value into an array with node element name

    Hi,
    I have the following code that displays the node element with the
    corresponding node value. I want to store the values in an array in
    reference to the node name.
    i.e.
    XML (my xml is much bigger than this, 300 elements):
    <stock>
    <symbol>SUNW</symbol>
    <price>17.1</price>
    </stock>-----
    would store the following:
    *data[symbol] = SUNW;*
    *data[price] = 17.1;*
    Thanks in advance,
    Tony
    test.jsp
    Here's my source code:
    <html>
    <head>
    <title>dom parser</title>
    <%@ page import="javax.xml.parsers.*" %>
    <%@ page import="org.w3c.dom.*" %>
    <%@ page import="dombean.*" %>
    </head>
    <body bgcolor="#ffffcc">
    <center>
    <h3>Pathways Info</h3>
    <table border="2" width="50%">
    <jsp:useBean id="domparser" class="dombean.MyDomParserBean" />
    <%
    Document doc = domparser.getDocument("c:/stocks/stocks.xml");
    traverseTree(doc, out);
    %>
    <%! private void traverseTree(Node node,JspWriter out) throws Exception {
    if(node == null) {
    return;
    int type = node.getNodeType();
    switch (type) {
    // handle document nodes
    case Node.DOCUMENT_NODE: {
    out.println("<tr>");
    traverseTree
    (((Document)node).getDocumentElement(),
    out);
    break;
    // handle element nodes
    case Node.ELEMENT_NODE: {
    String elementName = node.getNodeName();
    //if(elementName.equals("MOTHER-OCC-YRS-PREVIOUS")) {
    //out.println("</tr>");
    out.println("<tr><td>"+elementName+"</td>");
    NodeList childNodes =
    node.getChildNodes();     
    if(childNodes != null) {
    int length = childNodes.getLength();
    for (int loopIndex = 0; loopIndex <
    length ; loopIndex++)
    traverseTree
    (childNodes.item(loopIndex),out);
    break;
    // handle text nodes
    case Node.TEXT_NODE: {
    String data = node.getNodeValue().trim();
    //if((data.indexOf("\n")  <0) &#38;&#38; (data.length() > 0)) {
    out.println("<td>"+data+"</td></tr>");
    %>
    </table>
    </body>
    </html>
    {code}
    *MyDomParserBean.java*
    Code: package dombean;
    {code:java}
    import javax.xml.parsers.*;
    import org.w3c.dom.*;
    import java.io.*;
    public class MyDomParserBean
    implements java.io.Serializable {
    public MyDomParserBean() {
    public static Document
    getDocument(String file) throws Exception {
    // Step 1: create a DocumentBuilderFactory
    DocumentBuilderFactory dbf =
    DocumentBuilderFactory.newInstance();
    // Step 2: create a DocumentBuilder
    DocumentBuilder db = dbf.newDocumentBuilder();
    // Step 3: parse the input file to get a Document object
    Document doc = db.parse(new File(file));
    return doc;
    {code}
    Edited by: ynotlim333 on Sep 24, 2007 8:41 PM
    Edited by: ynotlim333 on Sep 24, 2007 8:44 PM
    Edited by: ynotlim333 on Sep 24, 2007 8:45 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    I still need to store it in an array because its 300 elements in the XML stocks.
    I've done the following but its not working, i'm getting error codes. I think its an easy fix. I'd also like to pass a String instead of a .xml document b/c my xml is stored inside a DB. Any suggestions on that?
    <html>
    <head>
    <title>dom parser</title>
    <%@ page import="javax.xml.parsers.*" %>
    <%@ page import="org.w3c.dom.*" %>
    <%@ page import="org.*" %>
    </head>
    <body bgcolor="#ffffcc">
    <center>
    <h3>Pathways Info</h3>
    <table border="2" width="50%">
    <jsp:useBean id="domparser" class="org.MyDomParserBean" />
    <%
    Document doc = domparser.getDocument("c:/stocks/stocks.xml");
    traverseTree(doc, out);
    %>
    <%!
            public String element_store = null;
            public String[] stock_data = new String[400];
            private void traverseTree(Node node,JspWriter out) throws Exception {
            if(node == null) {
               return;
            int type = node.getNodeType();
            switch (type) {
               // handle document nodes
               case Node.DOCUMENT_NODE: {
                 out.println("<tr>");
                 traverseTree
                 (((Document)node).getDocumentElement(),
                 out);
                 break;
              // handle element nodes
              case Node.ELEMENT_NODE: {
                String elementName = node.getNodeName();
                element_store = elementName;
                 //if(elementName.equals("MOTHER-OCC-YRS-PREVIOUS")) {
                   //out.println("</tr>");
                 NodeList childNodes =
                 node.getChildNodes();     
                 if(childNodes != null) {
                    int length = childNodes.getLength();
                    for (int loopIndex = 0; loopIndex <
                    length ; loopIndex++)
                       traverseTree
                       (childNodes.item(loopIndex),out);
                  break;
               // handle text nodes
               case Node.TEXT_NODE: {
                  String data = node.getNodeValue().trim();
                  if((data.indexOf("\n")  <0) && (data.length() > 0)) {
                  out.println("<tr><td>"+element_store+"</td>");
                  out.println("<td>"+data+"</td></tr>");
                  stock_data[element_store]=data;
    %>
    </table>
    </body>
    </html>

  • Assigning a value to an array cell populated [BULK]

    Hi all,
    I've got a problem in assigning a value to an array populated with BULK COLLECT INTO .
    I can reproduce the problem with this
    CREATE TABLE TEST_TABLE (
    value1 NUMBER,
    value2 NUMBER
    INSERT INTO test_table VALUES(1,1);
    INSERT INTO test_table VALUES(1,1);
    INSERT INTO test_table VALUES(1,1);
    INSERT INTO test_table VALUES(1,1);
    INSERT INTO test_table VALUES(1,1);
    INSERT INTO test_table VALUES(1,1);
    INSERT INTO test_table VALUES(1,1);
    INSERT INTO test_table VALUES(1,1);
    INSERT INTO test_table VALUES(1,1);
    INSERT INTO test_table VALUES(1,1);And this is the PL/SQL anonymous block that gives me problems:
    DECLARE
      SUBTYPE t_rec IS TEST_TABLE%ROWTYPE;
    TYPE records_table IS TABLE OF t_rec;
      elist RECORDS_TABLE;
      CURSOR table_cursor IS SELECT * FROM TEST_TABLE WHERE rownum <= 20;
    BEGIN
      OPEN table_cursor;
      FETCH table_cursor BULK COLLECT INTO elist;
        FOR j IN 1..elist.COUNT
        LOOP
          elist(j)(1) := elist(j)(1) +1;
        END LOOP;
      CLOSE table_cursor;
    END; The error is
    ORA-06550: line 13, column 7:
    PLS-00308: this construct is not allowed as the origin of an assignment
    ORA-06550: line 13, column 7:
    PL/SQL: Statement ignored
    06550. 00000 -  "line %s, column %s:\n%s"
    *Cause:    Usually a PL/SQL compilation error.
    *Action:So it doesn't compile because of this line of code:
    elist(j)(1) := elist(j)(1) +1;
    Why doesn't it work?
    If I try to do this, works perfectly:
    DECLARE
    TYPE v_num_table
    IS
      TABLE OF NUMBER;
    TYPE v_2_num_table
    IS
      TABLE OF v_num_table;
      v_nums V_2_NUM_TABLE := V_2_NUM_TABLE();
    BEGIN
      v_nums.EXTEND;
      v_nums(1) := v_num_table();
      v_nums(1).EXTEND;
      v_nums(1)(1) := 1;
      v_nums(1)(1) := v_nums(1)(1) +1;
      dbms_output.put_line(v_nums(1)(1) );
    END;Edited by: user10396517 on 2-mar-2012 2.35

    Variable "elist" is a collection of record, so you access an individual field of a given collection element by specifying the field name, not its position :
    DECLARE
      SUBTYPE t_rec IS TEST_TABLE%ROWTYPE;
      TYPE records_table IS TABLE OF t_rec;
      elist RECORDS_TABLE;
      CURSOR table_cursor IS SELECT * FROM TEST_TABLE WHERE rownum <= 20;
    BEGIN
      OPEN table_cursor;
      FETCH table_cursor BULK COLLECT INTO elist;
        FOR j IN 1..elist.COUNT
        LOOP
          elist(j).value1 := elist(j).value1 + 1;
        END LOOP;
      CLOSE table_cursor;
    END;Your second example is different as you're dealing with a collection of collections.

  • Problem in assigning value to an array element

    hi all
    in the following prog i am not able to assign the value to the array element
    i am not getting why it is giving me error
    //my program is as follows
    public class ArrayTest
         static int [] intArray = new int[5];
         static int [] intArray1 = new int[1];
         intArray1[0] = 5; // this line gives error
         static char [] charArray = new char[5];
         public static void main(String args[])
              System.out.println(charArray);
              intArray1 = intArray;
    }thanx in advance as usual

    The problem is that you try to execute code outside a method. This can be only done in form of a variable declaration or as a static initilization block which will be executed once when the class is loaded:public class ArrayTest
         static int [] intArray = new int[5];
         static int [] intArray1 = new int[1];
         static char [] charArray = new char[5];
         static {
              intArray[0] = 5;
         public static void main(String args[])
              System.out.println(charArray);
              intArray1 = intArray;
    }

  • How to insert values into an array of class

    Hello everyone,
    I need help in inserting values into an array of class, which i have read from a file.
    Length of the array is 5. I should insert values one by one into that array.
    If the array is full (if count = 5), then I should split the array into 2 arrays
    and adjust the values to left and right with median.
    I'm getting an ArrayBoundException .. can anybody help me out ?
    Thanks in advance
    Here is my code..........
    import java.util.*;
    import java.io.*;
    public class Tree
         static String second;
         static String first;
         static int count = 5;
         public void insert(int f1,int s1, int c)
              if(c!=0)
                   Record[] rec = new Record[4];
                   for (int i = 0; i < 5; i++)
                          rec[i] = new Record(); 
                   for(int i = 0; i<=4;i++)
                        rec.x = f1;
                        rec[i].y = s1;
              else
                   System.out.println("yes");
         public static void main(String[] args)
              Tree t = new Tree();
              try
                   FileReader fr = new FileReader("output.txt");           // open file
                   BufferedReader br = new BufferedReader(fr);
                   String s;
                   while((s = br.readLine()) != null)
                        StringTokenizer st = new StringTokenizer(s);
                        while(st.hasMoreTokens())
                             first = st.nextToken();
                             second = st.nextToken();
                        //     System.out.println("First-->"+first+" "+"Second-->"+second);
                        int fir = Integer.parseInt(first);
                        int sec = Integer.parseInt(second);
                        t.insert(fir, sec, count);                    
                   fr.close(); // close file           
              catch (IOException e)
    System.out.println("Can't read file");
    class Record
         public int x,y;

    Hi qwedwe.
    Record[] rec = new Record[4];
                   for (int i = 0; i < 5; i++)
                          rec[i] = new Record(); 
                     }Here is your error: you have an array of 4 Records, but you create and (try to) insert 5 Record-instances.... try:
    Record[] rec = new Record[c];
                   for (int i = 0; i < c; i++)
                          rec[i] = new Record(); 
                     }Regards,
    Norman

  • Need to store values in an array from a file

    My input file is a series of float numbers in a single line. I need to copy these values and store them in an array. Likewise i need to write these files stored in the array to a new file. can someone help me with the code.
    My data is something like this.
    0.000000000000000E+00 -9.983341664682815E-02 -1.986693307950612E-01 -2.955202066613396E-01 -3.894183423086505E-01 -4.794255386042030E-01 -5.646424733950355E-01 -6.442176872376911E-01 -7.173560908995228E-01 -7.833269096274834E-01 -8.414709848078965E-01 -8.912073600614354E-01 -9.320390859672264E-01 -9.635581854171930E-01 -9.854497299884603E-01 -9.974949866040544E-01 -9.995736030415051E-01 -9.916648104524686E-01 -9.738476308781951E-01 -9.463000876874145E-01 -9.092974268256817E-01 -8.632093666488737E-01 -8.084964038195901E-01 -7.457052121767200E-01 -6.754631805511506E-01 -5.984721441039565E-01 -5.155013718214642E-01 -4.273798802338298E-01 -3.349881501559047E-01 -2.392493292139820E-01 -1.411200080598672E-01 -4.158066243329049E-02 5.837414342758009E-02 1.577456941432487E-01 2.555411020268317E-01 3.507832276896198E-01 4.425204432948525E-01 5.298361409084934E-01 6.118578909427193E-01 6.877661591839741E-01 7.568024953079282E-01 8.182771110644108E-01 8.715757724135882E-01 9.161659367494549E-01 9.516020738895160E-01 9.775301176650970E-01 9.936910036334645E-01 9.999232575641008E-01 9.961646088358406E-01 9.824526126243325E-01 9.589242746631385E-01 9.258146823277321E-01 8.834546557201531E-01 8.322674422239008E-01 7.727644875559871E-01 7.055403255703919E-01 6.312666378723208E-01 5.506855425976376E-01 4.646021794137566E-01 3.738766648302360E-01 2.794154981989259E-01 1.821625042720950E-01 8.308940281749640E-02

    ram.west wrote:
    hi,
    i tried using string tokenizer, but i need to pass the values as float values to the array..The recommendation for StringTokenizer was a mistake. You could use split instead. Or a Scanner.
    At any rate so you have some Strings. Which you want to turn into floats.
    If only Java had a class, I don't know, let's call it java.lang.Float, and if only such a class existed wouldn't it be just brilliant if it had some sort of method that could parse a float primitive out of a given String?
    I mean wouldn't that be just amazing ?

  • Get value from the array based on the HashCode

    public static void runJoin(int[][] t1,int[][] t2)
         PrintWriter out=null;
         int rows = 1000;
         int cols = 7;
         int [][] myTable3 = new int[rows][cols];
         int x = 0;
         System.out.print("Running HashJoin:Method loads the "+
         "smaller table in the memory and applies a hashing function "+
         "to common column and stores it in another table. "+
         "The larger table is then read from the file. "+
         "The same hashing function is applied to Col n of the table and a       matching record in the first table is looked up. A match will create a row in Table 3. ");          
    //Apply hashing function to smaller table and store it in the memory.
              Integer[] It2 = new Integer[t2.length];
              int [] hashCodest2 = new int[t2.length];
              Hashtable ht = new Hashtable();
              for(int i =0; i <t2.length;i++){
                   It2[i] = new Integer(t2[0]);
                   hashCodest2[i] = It2[i].hashCode();
                   ht.put(new Integer(hashCodest2[i]),It2[i]);
              //Larger table get hashcodes
              Integer It1[] = new Integer[t2.length];
              int [] hashCodest1 = new int[t2.length];          
              for(int j =0; j <t1.length;j++){
                   It1[j] = new Integer(t1[j][4]);
                   hashCodest1[j] = It1[j].hashCode();               }
              //Based on the hashcode get the value from the Table2;
              try{
    out = new PrintWriter( new FileOutputStream( "c:\\HashJoinTable.txt" ) );
              Enumeration e = ht.keys();
                   while(e.hasMoreElements())
    //How do I get the value from the array based on the HashCode? Do I need to do a loop here???                         
    hashCodes1.get(e.nextElement());           
              }catch(Exception e){}

    ok I got it......
              //Apply hashing function to smaller table and store it in the memory.
              Integer[] It2 = new Integer[t2.length];
              int [] hashCodest2 = new int[t2.length];
              Hashtable ht = new Hashtable();
              for(int i =0; i <t2.length;i++){
                   It2[i] = new Integer(t2[0]);
                   hashCodest2[i] = It2[i].hashCode();
                   ht.put(new Integer(hashCodest2[i]),It2[i]);
              //Larger table get hashcodes and compare
              Integer It1[] = new Integer[t2.length];
              int [] hashCodest1 = new int[t2.length];          
              Hashtable ht2 = new Hashtable();
              for(int j =0; j <t1.length;j++){
                   It1[j] = new Integer(t1[j][4]);
                   hashCodest1[j] = It1[j].hashCode();               
                   ht2.put(new Integer(hashCodest1[j]),It1[j]);
              //Based on the hashcode get the value from the Table2;
              try{
    out = new PrintWriter( new FileOutputStream( "c:\\HashJoinTable.txt" ) );
              Enumeration e = ht.keys();
              Integer t3[] = new Integer[t2.length];
                   while(e.hasMoreElements())
                        t3[x] = (Integer) ht2.get(e.nextElement());                
                        x++;
              }catch(Exception e){}

  • How does this program group and cluster these button values into an array?

    In the attached program, there are 6 buttons in a cluster and 1 individual button. These buttons control a bunch of different relays to control power to different components of a single device. Right now the program works in that I can control the 6 buttons, the LED turns on in the board and the power is being transmitted. What I do not understand is how it is doing this.  I ran the program with the highlight execution on and at the start of the read from array component, if say I pressed button 6 and hit ok, it reads #6, where did these get defined and labled? and if i wanted to add another button/relay how do i do this? If someone could explain step by step how this is grouping the relays on the board into an array and then controling them I would really appreciate it. Thanks.
    Solved!
    Go to Solution.
    Attachments:
    Cluster to Array.vi ‏85 KB

    The #6 your seeing is the number of elements in the array not a value for the array. 
    Now for some deeper explainations.   From the code it appears that exactly 1 of 6 valves may be used and an additional valve may be in one of two possible states.
    When the program is run the cluster of buttons is initiallized to all False.  and we enter the outer while loop where a sequence structure starts.  In the first frame of the sequence we initiallize a shift register to hold the current value of "Buttons." and this loop runs unthrottled (Add a wait for next ms multiple to this loop to prevent using 100% of the CPU!) 
    For each iteration the buttons are read and if a change has occured to any value buttons that were previously True are reset to False to prevent opening more than one valve.
    When the user presses OK or stop- the current "Buttons" value is passed to the next frame.  This frame convertsthe 7 boolean values to a integer where each valve is controlled by a seperate bit of the integer (Isolation is bit 6 and bits 0-5 each control a mixing valve)
    Now I'd strongly recommend reworking the DAQmx calls- it is pointless to initiallize the task each time you want to use it- Create the task in the initialzation case and wait until the user exits to destroy the task.  And well a sequence structures are frowned on- (there are better ways to do this)
    As far as adding a relay- right now the relays are associated to the hardware by their index position in the cluster (element 1 = bit 0 etc....) to add a new valve you would need to decide what bit you would use to drive it and code in that bits' value to write a 0 in that bit.  (hint the 40 constant is realy 0x40 right-click>visable items>show radix )
    Let me know if you need further elaboration
    Jeff

  • Maximum five values in 2d array

    Hi, I have a vi that reads in values from a 2D array and then uses this information. I am currently using the "Array Max & Min" vi to find the maximum values from the array. It may be beneficial for my application to find the maximum 5 or some other number of values in the array. My current plan is to use a loop that finds the maximum value from the original array and then subtract that value and repeat the operation 5 or so times. However, I believe this is innefficient and may take a long time in a vi that needs to run fairly quickly. I would appreciate some suggestion. Thanks in advance.
    Solved!
    Go to Solution.

    Hi,
    In my case, I need to find peak values in the 2D array that, usually, are not the biggest values in the array. For example, in the color map below, I need to get the peak values that are isolated from each other. Any ideas?
    Thanks in advance.
    Attachments:
    color map.jpg ‏45 KB

Maybe you are looking for

  • Windows Server 2012 - Hyper-V - iSCSI SAN - All Hyper-V Guests stops responding and extensive disk read/write

    We have a problem with one of our deployments of Windows Server 2012 Hyper-V with a 2 node cluster connected to a iSCSI SAN. Our setup: Hosts - Both run Windows Server 2012 Standard and are clustered. HP ProLiant G7, 24 GB RAM, 2 teamed NIC dedicated

  • Can't work out how to stop Mac mail from Forwarding to GMail account.

    Okay. This is on behalf of my sister. For whatever reason, when emails are sent to her @mac.com address they get forwarded to her GMail account and deleted from her @mac.com address. So they never appear in her @mac.com inbox. She now wants this rela

  • To count the elements in this Source

    hi all, I have a Source created by: Source s = m1.join(m2).join(m3).join(d1).join(d2); m1, m2, m3: MdmMeasure of the same Cube C1 d1, d2: MdmPrimaryDimension of the same Cube C1 I want to count the elements in this Source that have values so I used:

  • Hierachical table webdynpro and VC

    Hello everyone, Is it possible to do a hierachical table in VC and how? What i mean is it possible to create some type of tree structure in a VC table, comething like this: http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/de59f7c2-0

  • BADI_LE_SHIPMENT creating Partner function record?

    Hi All, When creating a shipment from VT01N  I am trying to update the partner function field values PARTNER TYPE (PARVW) and PARTNER under the Partner tab from BADI -  BADI_LE_SHIPMENT in SAVE method. So I am passing         ls_new_vbpa-kunnr = part