Adding two arrays together

I am trying to add two arrays together, it does not seem as if the arrays are broken up into more than one index. I have attached my code. If the array is broken up into indexes I would like to add each corresponding index, but I think the array is all in just one index and if so I was wondering how would I break it into indexes. Thanks
Attachments:
SimpleTest x1.vi ‏336 KB

Since you are "transposing" and later work with 1D array, I assume you want to read the first column of the file.
Why do you need a sequence stacked 5 frames deep, local variables, 5 instances of the same boolean diagram constant and 5 path conststants of which some are identical??? None of this is needed!
All you need is probably something along the lines of the following picture, which probably does something similar to what you want. Still, we are probably still jumping through too many flaming hoops. Note that the execution order is uniquely defined by the wiring alone, no sequence needed! Can you take a step back and tell us what you are actually trying to achieve with all this? How many columns are in the file? Only one?
Message Edited by altenbach on 01-27-2009 04:02 PM
LabVIEW Champion . Do more with less code and in less time .
Attachments:
AddArraysFromFile.png ‏13 KB

Similar Messages

  • How to join two arrays together?

    I have the following type
        type TVarcharArr is table of varchar(4000) index by binary_integer;I have a procedure that passes in two separate arrays as:
        p_account_number                 in TVarcharArr,
        p_product_system_code          in TVarcharArrThese arrays are related (they will have the same number of elements), the contents would be as follows:
        Account Number    Product System Code
        123                      ABC
        456                      DEF
        789                      GHII can use TABLE(CAST to turn each of these arrays into a table, but how do I join these two arrays together so that they become a single table with two columns? Or if I CAST them as TABLEs, how can I join these two tables together - is there some way of using the index to facilitate the join?
    Cheers
    Richard

    You are right, I do need to convert the arrays first to use TABLE(CAST, and I do have my concerns about the use of rownum.
    Here's the test case I built to test what I'm doing, incorporating the rownum solution:
    declare
        type TVarcharArr is table of varchar(4000) index by binary_integer;
        v_arr   TVarcharArr;
        v_tab  tchartab := tchartab();
        v_arr2   TVarcharArr;
        v_tab2  tchartab := tchartab();   
    begin
        v_arr(1) := 'ABC';
        v_arr(2) := 'DEF';
        v_arr(3) := 'GHI';
        v_arr2(1) := '123';
        v_arr2(2) := '456';
        v_arr2(3) := '789';   
        v_tab.extend(v_arr.Count);   
        for i in v_arr.first .. v_arr.last
        loop
            v_tab(i) := v_arr(i);
        end loop;   
        v_tab2.extend(v_arr2.Count);   
        for i in v_arr2.first .. v_arr2.last
        loop
            v_tab2(i) := v_arr2(i);
        end loop;   
        for rec in (with w_acct as
                    (select rownum rn, a.column_value acol
                    from table(cast(v_tab as tchartab)) a
                         w_prod as
                    (select rownum rn, b.column_value bcol
                    from table(cast(v_tab2 as tchartab)) b
                    select acol,bcol
                    from w_acct a,
                         w_prod b
                    where a.rn = b.rn) loop
            DBMS_OUTPUT.PUT_LINE ( 'rec = ' || rec.acol || '|'|| rec.bcol );
            null;
        end loop;
    end;It does return the correct result - but can it be trusted to be consistent - does the rownum in an array suffer the same problems as the rownum from a regular select? I'm guessing it's too risky to find out.
    In essence, I'm getting two arrays and I'm trying to join them together so that I can CAST them as a table. (And I know the real question is why isn't it just one array of records with two elements - but sometimes you have to work with what you're given)

  • Adding two sums together

    Post Author: nickyboyc
    CA Forum: Formula
    Hi guys, I'm very new to Crystal reports and having what I'm sure is a simple problem. I'm getting data from a Oracle Database via ODBC and I've created some summaries and groups and the final piece in my jigsaw is I want to add two sums together and for the life of me I can't find out how to do it. I've tried and tried and I just can't get it to work.They are in a group and the 2 sums are :
    Sum ({WMLocnHandlingMediaConf.QtyStor}
    and
    Sum ({WMLocnHandlingMediaConf.QtyIn}Many thanks in advance Nick

    Post Author: yangster
    CA Forum: Formula
    just create a formula with your 2 sums in there@sum
    Sum ({WMLocnHandlingMediaConf.QtyStor}+
    Sum ({WMLocnHandlingMediaConf.QtyIn}

  • Adding two BufferedImages together?

    Is there anyway to "for lack of a better word add two bufferedImages together?
    For example if I have a JLabel with an ImageIcon thats a red square 32 x 32 pixels and another JLabel with an ImageIocn thats a green square also 32 x 32 pixels. Can I create a new ImageIcon thats 64 x 32 pixels that is the red square and green square together?
    Something like new BufferedImage(image1, image2,  concanate_xaxis);Thanks,
    Cathal.
    cathal87

    Ive tryed to impliment your above suggestion camickr, but all I can seem to get as output is a black image.
    Heres some code that demonstrates my problem.
    Once the following code is compiled and run an image is created using all of the JLabels ImageIcons from the JFrame and its saved into a file at "C:/Image.png". Obviously this would have to be changed for testing purposes depending on ones OS and Drive letter preferences.
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.BufferedImage;
    import java.io.*;
    import javax.imageio.*;
    public class Example2
           static JFrame frame;
           static JLayeredPane layeredPane;
           public static void main(String[] args)
                  frame = new JFrame("Example");
                  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                  frame.setResizable(false);
                  frame.setSize(320, 320);
                  frame.setLocationRelativeTo(null);
                  frame.getContentPane().setLayout(null);
                  layeredPane = new JLayeredPane();
                  layeredPane.setOpaque(true);
                  layeredPane.setLayout(null);
                  layeredPane.setBounds(0, 0, 320, 320);
                  frame.setContentPane(layeredPane);
                  for(int i = 0; i < 32; i ++)
                          for(int j = 0; j < 32; j ++)
                               JLabel label = new JLabel(new ImageIcon("images/grass.gif"));
                               layeredPane.add(label, new Integer(0));
                               label.setBounds(i * 32, j * 32, 32, 32);
                  frame.setVisible(true);
                  createAndSaveImage();
           public static void createAndSaveImage()
                  BufferedImage image = new BufferedImage(320, 320, BufferedImage.TYPE_INT_RGB);
                  Component[] components = layeredPane.getComponentsInLayer(0);
                  int count = 0;
                  for(int i = 0; i < 32; i ++)
                          for(int j = 0; j < 32; j ++)
                                  JLabel label = (JLabel)components[count];
                                  label.getGraphics().drawImage(image, i, j, 32, 32, null);
                                  count ++;
                  try
                        ImageIO.write(image, "png", new File("C:/Image.png"));
                  catch(Exception exexe)
    }

  • Adding two array lists together and a text file to an array list

    I'm having problems coding these two methods... Could someone explain how to do this? I can't find information on it anywhere... :(
    "MagazineList" is the class I'm coding in right now, and I already declared "list" as an array list of another class called "Magazine".
    public boolean addAll(MagazineList magazines)
           if (list == magazines) {
               return false;
            else {
                list.addAll(magazines);
           return true;
       public boolean addAll(String filename)
           Scanner in = ResourceUtil.openFileScanner(filename);
            if (in == null) {
               return false;
            String line = source.nextLine();
            while (!line.equals("")) {
              list.add(Magazine(source));
           in.close();
       }

    I assume "addAll(MagazineList magazines)" is defined in the MagazineList class?
    Then,
    list.addAll(magazines);probably needs to be something like:
    list.addAll(magazines.list);This uses the private variable ( should be private) list from the input MagazineList, and adds all of those Magazine objects to the list in the current MagazineList.
    But, yes, describe your problems more clearly, and you'll get better answers more quickly (because people will be able to understand you and give you a suggestion without asking you another question first).

  • Seeing a problem adding two numbers together (or I've lost my mind)

    I have a resource adapter that provides support for an implementation of the (RDP) Reliable Datagram Protocol (RFC 908/1151) that I wrote. I'm having a problem when this is deployed to a SunFire V480 with 4 CPUs running Glassfish 9.1u2 with JDK 1.6.0_05.
    Basically what I am seeing is that when I add 1 to a number sometimes it works and sometimes it does not. So I am losing my mind and I am hoping someone here can help me see the errors in my ways.
    The protocol uses sequence numbers similar to TCP. So in my code, when I receive a RDP message it need to check to see that the sequence number matches what is expected. Basically an instance of a class that represents a connection maintains the last sequence number seen and the message coming in had better have this sequence number plus 1.
    Here is the code that I'm having a problem with:
    +if (__LOGPROTO.isLoggable(Level.FINER)) {+
    __LOGPROTO.finer("receiveMessage inmsg.seq = " inmsg.getSequenceNumber() + " __rcvcur = " + __rcvcur + " SEQ_PLUS = " + SEQ_PLUS(__rcvcur, 1) + "this = " + this);+
    +}+
    +if (inmsg.getSequenceNumber() == SEQ_PLUS(__rcvcur, 1)) {+
    +if (inmsg.getDataLength() > 0) {+
    +// Save the data+
    ackMsg = new RDPAckMessage(inmsg);
    __rcvdList.add(ackMsg);
    +if (__LOGPROTO.isLoggable(Level.FINER)) {+
    __LOGPROTO.finer("receiveMessage message queued to user " this);+
    +}+
    notifyReceivable = true;
    +// Signal that there is data available+
    __signal.setValue(true);
    +}+
    __rcvcur = inmsg.getSequenceNumber();
    +// Now see if we have any out of order segments that can+
    +// be queued to the user+
    for (i = 0; i < __rcvrcvdseqno.length; i+) {+
    +if (__rcvrcvdseqno != null) {+
    if (__rcvrcvdseqno != null && SEQ_EQ(__rcvrcvdseqno.getSequenceNumber(),
    +SEQ_PLUS(__rcvcur, 1))) {+
    +__rcvcur = __rcvrcvdseqno] 0) {+
    +// Move over to the received list+
    ackMsg = new RDPAckMessage(__rcvrcvdseqno);
    +if (__LOGPROTO.isLoggable(Level.FINER)) {+
    __LOGPROTO.finer("receiveMessage ood message queued to user " this);+
    +}+
    __rcvdList.add(ackMsg);
    notifyReceivable = true;
    +// Signal that there is data available+
    __signal.setValue(true);
    +}+
    __rcvrcvdseqno = null;
    +}+
    +}+
    +}+
    +} else {+
    +if (__LOGPROTO.isLoggable(Level.FINER)) {+
    __LOGPROTO.finer("xxx receiveMessage inmsg.seq = " inmsg.getSequenceNumber() + " __rcvcur = " + __rcvcur + " SEQ_PLUS = " + SEQ_PLUS(__rcvcur, 1) + "this = " + this);+
    +}+
    I have a couple of log messages that I put in to help try to figure out what in the heck is going on. The first prints out the message sequence number, the last sequence number that was known (__rcvcur), and the result of a method called SEQ_PLUS which passes in "__rcvcur" and '1".
    Here is the SEQ_PLUS code:
    +private long SEQ_PLUS(+
    +long x,+
    +long y) {+
    +long z = (x + y) % 0x100000000L;+
    +return z;+
    +}+
    Basically what I am seeing is that SEQ_PLUS is correctly adding 1 to "__rcvcur" on one call and then not adding 1 in the next.
    Here is the log messages that occur. Note that "this" is the same in all of the log messages, that the thread is the same in all log messages, but in one instance SEQ_PLUS works and another it does not.
    +[#|2008-09-23T11:04:49.580-0400|FINER|sun-appserver9.1|com.canoga.lib.io.rdp.RDPConnection.msg|_ThreadID=30;_ThreadName=RDPConnectionEngineUDP;ClassName=com.can+
    +oga.java.io.rdp.RDPConnection;MethodName=receiveMessage;_RequestID=e6876cf2-0fb9-4de3-938a-484eee9a2b7a;|receving msg[<ACK> from=1024 to=1787 datalen=5 seq=16839 ack=1355376372] by RDPConnection(com.canoga.java.io.rdp.RDPConnection@125f069):/172.16.142.16|#]+
    +[#|2008-09-23T11:04:49.581-0400|FINER|sun-appserver9.1|com.canoga.lib.io.rdp.RDPConnection.proto|_ThreadID=30;_ThreadName=RDPConnectionEngineUDP;ClassName=com.c+
    +anoga.java.io.rdp.RDPConnection;MethodName=receiveMessage;_RequestID=e6876cf2-0fb9-4de3-938a-484eee9a2b7a;|receiveMessage inmsg.seq = 16839 __rcvcur = 16838 SEQ_PLUS = 16839this = RDPConnection(com.canoga.java.io.rdp.RDPConnection@125f069):/172.16.142.16|#]+
    +[#|2008-09-23T11:04:49.581-0400|FINER|sun-appserver9.1|com.canoga.lib.io.rdp.RDPConnection.proto|_ThreadID=30;_ThreadName=RDPConnectionEngineUDP;ClassName=com.c+
    +anoga.java.io.rdp.RDPConnection;MethodName=receiveMessage;_RequestID=e6876cf2-0fb9-4de3-938a-484eee9a2b7a;|xxx receiveMessage inmsg.seq = 16839 __rcvcur = 16838 SEQ_PLUS = 16838this = RDPConnection(com.canoga.java.io.rdp.RDPConnection@125f069):/172.16.142.16|#]+
    I am at a loss as to how this could occur. I'm hoping some bright mind can see what I cannot.
    Any help will be greatly appreciated.
    Brett

    Actually the nested code in the follow up is a SCCE:
                                if (__LOGPROTO.isLoggable(Level.FINER)) {
                                    __LOGPROTO.finer("xxx receiveMessage inmsg.seq = " + inmsg.getSequenceNumber() + " __rcvcur = " + __rcvcur + " SEQ_PLUS = " + SEQ_PLUS(__rcvcur, 1L) + "this = " + this);
                                    long x = __rcvcur;
                                    long y = 1;
                                    long z = (x + y) % 0x100000000L;
                                    __LOGPROTO.finer("xxx x is " + x + " y is " + y + " z is " + z);
                                }There is nothing in this snippet that should allow "y" to be anything other than the value '1" which it is initialized to, no matter how many threads, cpu's, etc there may be since "x, y, and z" are stack local variables and "y' is never assigned to after it is initialized. The output of the log message shows however that sometimes it is different:
    [#|2008-09-23T12:15:38.505-0400|FINER|sun-appserver9.1|com.canoga.lib.io.rdp.RDPConnection.proto|_ThreadID=28;_ThreadName=RDPConnectionEngineUDP;ClassName=com.c
    anoga.java.io.rdp.RDPConnection;MethodName=receiveMessage;_RequestID=77189b23-d5ff-49c3-8194-662f468bbe66;|xxx x is 16838   is 4294967296 z is 16838|#]This code is within a very large Java EE application running under the Glassfish application server. The problem manifests itself about
    about 1 of every 4 starts of the application server and I have only seen it occur on Solaris on my V480 server.
    So if someone can explain how "y" becomes "4294967296" I would very thankful.

  • Adding two time figures together

    Please forgive me I am not familiar with FormCalc or Javascript.
    I am creating a form for work and I need to add two time figures minutes and seconds (IE 02:30 + 02:30) I have looked all over the web and I can not find anything that is working,
    I can add the two figures together but I get (ie 4:60)
    please any help you can give will be be wonderful

    Hi Chris,
    No need to shout.
    Formula in column C (calculates the Duration (time elapsed) between two Date and Time values:
    =B-A
    Formula in column D (Calculates the same Duration as above, but subtracts 30 minutes if the total Duration is greater than 5 hours):
    =IF(DUR2HOURS(B-A)>5,B-A-DURATION(,,,30,,),B-A)
    Note that any cell displaying a Date or a Time (of day) or both contains a Date and Time value.
    If only the Date has been entered, the time part is set to 00:00:00 (midnight, at the beginning of that day).
    If only the Time has been entered, the date part is set to the date the entry was made.
    In the table above, the values in Row 18, the bottom row of the table are as follows:
    A18: March 1, 2012 11:00:00 AM
    B18: March 1, 2012 5:00:00 PM
    C18: 6h
    D18: 5h 30m
    The first two are Date and Time values, the second two are Duration values.
    Regards,
    Barry

  • User defined func: Unavble to merge two arrays in result list

    Hi
    I am trying to merge two arrays on the basis of "FEE" element in the input file;
    Actually there is an Attribute Name and Value pair array coming in the input file which has 5 pairs already(Notification + 100 , oversize + 8 etc.) see example below;
    <m0:Fees>ZB9</m0:Fees>
    <m:Attribute>
      <m0:Attributename>NOTIFICATION</m0:Attributename>
      <m0:Attributevalue>100</m0:Attributevalue>
      </m:Attribute>
    <m:Attribute>
      <m0:Attributename>OVERSIZE</m0:Attributename>
      <m0:Attributevalue>8</m0:Attributevalue>
      </m:Attribute>
    <m:Attribute>
      <m0:Attributename>OVERWEIGHT</m0:Attributename>
      <m0:Attributevalue>108</m0:Attributevalue>
      </m:Attribute>
    <m:Attribute>
      <m0:Attributename>SIGNATURE</m0:Attributename>
      <m0:Attributevalue>294</m0:Attributevalue>
      </m:Attribute>
    <m:Attribute>
      <m0:Attributename>RTS</m0:Attributename>
      <m0:Attributevalue>8</m0:Attributevalue>
      </m:Attribute>
    The condition is:
    CASE 1. If the FEE doesn't exist in the file then only the Atrribute Name and Value in added to the Array
    CASE 2 If FEE exist then add all the Atrribute Name and Value pairs as well as in the last index of Array add String "Fee" in Attributename and String "ZB9" in  Attributevalue.
    CASE 1 is working fine.
    but in CASE 2 even if i m taking an output array of length Attributename +1 and Attributevalue +1 and trying to add "Fee" and "ZB9" respectively, it never happens.
    Please have a look at the code below;
       //write your code here
    public void ud_Attributename(String[] Fees,String[] Attributename,ResultList result,Container container){
              String attribute_copy[]=new String[Attributename.length+1];
              String attribute_name[]=new String[Attributename.length];
              String array_copy1[]=new String[Attributename.length+1];
              //int len =Attributename.length;
              if(Fees[0]!=null)
                   if(Fees[0].equals("ZB0"))
                   Fees[0]="01";
                   else if(Fees[0].equals("ZB5"))
                   Fees[0]="02";
                   else if(Fees[0].equals("ZB6"))
                   Fees[0]="03";
                   else if(Fees[0].equals("ZB9"))
                   Fees[0]="04";
              try{
                   if((Fees[0]=="01")||(Fees[0]=="02")||(Fees[0]=="03")||(Fees[0]=="04"))
                        for(int x=0;x<=Attributename.length;x++)
                             if(x==Attributename.length)
                             array_copy1[x]="Fee";
                             else{
                             array_copy1[x]=Attributename[x];
                             result.addValue(array_copy1[x]);
                   else
                        for(int i=0;i<=len;i++)
                             attribute_name<i>=Attributename[i+1];
                             result.addValue(attribute_name<i>);
              }catch(Exception e)
              {e.printStackTrace();}
    Same way i've used for Attributevalue.
    But the result is
    <ATTRIBUTEPAIR>
    <PAIR>
    <NAME>NOTIFICATION</NAME>
    <VALUE>04</VALUE>
    </PAIR>
    <PAIR>
    <NAME>OVERSIZE</NAME>
    <VALUE>8</VALUE>
    </PAIR>
    <PAIR>
    <NAME>OVERWEIGHT</NAME>
    <VALUE>108</VALUE>
    </PAIR>
    <PAIR>
    <NAME>SIGNATURE</NAME>
    <VALUE>294</VALUE>
    </PAIR>
    <PAIR>
    <NAME>RTS</NAME>
    <VALUE>8</VALUE>
    </PAIR>
    </ATTRIBUTEPAIR>
    Please suggest where i am wrong. ur help is very much appreciated.
    Thnks in advance

    this is i am doing now
       //write your code here
              String attribute_copy[]=new String[Attributename.length+1];
              String attribute_name[]=new String[Attributename.length];
              String attribute_name1[]={"Fee"};
              //String[] Attributename.copyTo(attribute_name1,0);
              //String[] attribute_name1 = (String[]) Attributename.Clone();
              //String fees;
              String array_copy1[]=new String[Attributename.length];
              int len =Attributename.length;
              for(int y=0;y<len;y++){
              array_copy1[y]=Attributename[y];
              if(Fees[0]!=null)
                   if(Fees[0].equals("ZB0"))
                   Fees[0]="01";
                   else if(Fees[0].equals("ZB5"))
                   Fees[0]="02";
                   else if(Fees[0].equals("ZB6"))
                   Fees[0]="03";
                   else if(Fees[0].equals("ZB9"))
                   Fees[0]="04";
                   else if(Fees[0].equals("ZA1"))
                   Fees[0]="05";
                   else if(Fees[0].equals("ZA2"))
                   Fees[0]="06";
              try{
                   if((Fees[0]=="01")||(Fees[0]=="02")||(Fees[0]=="03")||(Fees[0]=="04")||(Fees[0]=="05")||(Fees[0]=="06"))
                        int j=0;
                        for(int a=0;a<=len;a++)
                             if(j==0&&attribute_copy[j]==null)                                   
                                  attribute_copy[j]="Fee";
                             else
                                  //int b=-1;
                                  for(int i=0;i<=len;i++)
                                       if(i==j)
                                       //i=i-1;
                                       attribute_copy[j]=array_copy1[i-1];
                                       break;
                                       else{
                                       continue;}
                        result.addValue(attribute_copy[j]);
                        j+=1;
                   else
                        for(int i=0;i<=len;i++)
                             attribute_name<i>=Attributename[i+1];
                             result.addValue(attribute_name<i>);
              }catch(Exception e)
              {e.printStackTrace();}
    and the result in queue is
    SUPPRESS
    [FEE]
    [NOTIFICATION]
    [NOTIFICATION]
    [OVERSIZE]
    [OVERSIZE]
    [OVERWEIGHT]
    [OVERWEIGHT]
    [SIGNATURE]
    [SIGNATURE]
    [RTS]
    [RTS]
    but in the output i m getting
    <ATTRIBUTEPAIR>
    <REF_HANDLE>0001</REF_HANDLE>
    <PAIR>
    <NAME>Fee</NAME>
    <VALUE>04</VALUE>
    </PAIR>
    <PAIR>
    <NAME>OVERSIZE</NAME>
    <VALUE>8</VALUE>
    </PAIR>
    <PAIR>
    <NAME>OVERWEIGHT</NAME>
    <VALUE>108</VALUE>
    </PAIR>
    <PAIR>
    <NAME>SIGNATURE</NAME>
    <VALUE>294</VALUE>
    </PAIR>
    <PAIR>
    <NAME>RTS</NAME>
    <VALUE>8</VALUE>
    </PAIR>
    </ATTRIBUTEPAIR>
    Notification is missing.

  • Writing two arrays to a Excel Spreadsheet

    Guru's
    I am trying to take information from two arrays and write them to a spreadsheet. One array generates the headers information for the columns, the other array is a random number generator. The number of columns and rows are input from the front panel. The first column of the chart is time at some multiple (interval) input from the front panel
    The problem I am having is timing the data out of the loop at the same time so they write together. One loop writes first and the other is left out. The data is going out to an excel spreadsheet. The data is correct for the headers and the columns, but won't write together.
    I have only been using LabView for six weeks and have spent a good portion of this weekend working on this problem.
    Attached are screen shots and the .vi of the problem. Explanations of each loop are writen in the block diagram.
    Thank you for your time and help!!
    Newbie2
    Attachments:
    writing to excel problem.doc ‏195 KB
    Writing to excel problem.vi ‏27 KB

    First let's talk about the code flaws:
    Placing a text decoration over a path constant does not turn it into a valid path constant.
    All your controls belong outside the loop, because it would be really bad if they could change during running of the loop. This is also less work, because LabVIEW does not need to re-inspect the control during each iteration.
    Your while loop should be a FOR loop because the number of iteration can be calculated before the loop starts. This eliminates checking for termination.
    You are not writing any excel files. You are just writing an ASCII table, but you possibly force excel to open it via a fake file extension. (this might be OK, but make sure to NEVER save it later as excel or the file structure would change dramatically).
    "# of rows" and "# of machines" should be integers (blue).
    Don't be afraid to brance a wire. You don't need any local variables if you do so.
    To determine the order in which the segments are written to the file can be determined by dataflow if you wire it correctly. Wire the path to the write function that needs to write first. Then use the path output of this function and wire it to the next instance. Now the second instance must wait until the first one is finished.
    (Currently you are branching the path wire, and the execution order is random!)
    LabVIEW Champion . Do more with less code and in less time .

  • Tie two songs together

    I'd like to be able to tie two songs together so they always play back to back, yet in a complete shuffle mode. For instance Van Halen's Eruption / You Really Got Me Down. They appear as separate songs on the CD, so they play randomly on the shuffle. Is there a way to tie pairs of songs together?
    Thanks

    You can join tracks when importing from the CD. Insert your CD highlight the songs you want to join and choose "Join CD Tracks" from the Advanced menu and import: Adding songs from CDs to your library

  • 'Merge Cell' is greyed out - how do I activate it and merge two cells together?

    I am just learning Numbers, trying to merge two cells together should be a very simple process!
    I have followed the instructions in help
    The 'merge cells' function remains greyed out no matter what I do - I therefore cannot merge two or more cells into one!
    Please help, is there something I need to activate in the cell?

    Hi Claudia,
    Actually, a "truly blank document" would be an empty canvas, containing no table of any type, no document header or footer locations, no document margins, no page definitions, no page orientation. Just a blank sheet onto which you could put whatever objects you wish.
    Perhaps Apple should have named the 'not blank' templates "Basic" rather than blank, removed the header column, and left the header row intact. That would match the "Basic" table style available in the Tables button's menu, used for adding a table to a Sheet.
    If you really do want to always start with a table which has no header rows and no header columns, it's easy enough to set up.
    Open a new 'blank' document (Apple's 'blank').
    Click on the Table 1 icon in the Sheets list and press delete. (faster than selecting cell A1, then taking two trips to the Table menu to delete first the (header) row then the (header) column)
    Click the Tables button and choose Plain to insert a 'plain' table (no header row, no header column)
    (optional) Add or delete rows or columns to make the blank table the size you desire.
    (optional) Position the table where you want it.
    Save the result as a Template.
    In Numbers Preferences > General > For New Documents, select Use Template, then Choose your new template.
    Until you change that preference, any New document you make will contain your new, 'blank' table.
    Regards,
    Barry

  • About combing two array into one

    Hi all,
      I post a questiona bout converting an array of integer into char (byte) array and I got a solution already http://forums.ni.com/t5/LabVIEW/how-to-display-char-code-properly/m-p/2596087#M780368
    However, I enouther another problem while dealing with an array of  U16 type. I would like to extract the high and low byte from numbers (U16) stored in array. I extract the high and low byte for each U16 number and convert them as char, concatenate them to a string. Repeat this process for each element in the array so to get a big string with each element is a char for high and low byte. My code is enclosed as follows
    It works fine but I am concerning the speed. Is that any other way to do it fast and don't use loop (in real case, I will deal with pretty big array many times, efficiency is a problem). Note that the high and low bytes array extracted from the original array with the module Split number.vi, but how can I combine these two array in one code with data arranged as high-low-high-low ... ? Thanks.
    Solved!
    Go to Solution.

    PKIM wrote:
    However, I enouther another problem while dealing with an array of  U16 type. I would like to extract the high and low byte from numbers (U16) stored in array. I extract the high and low byte for each U16 number and convert them as char, concatenate them to a string. Repeat this process for each element in the array so to get a big string with each element is a char for high and low byte. My code is enclosed as follows
    It works fine but I am concerning the speed. Is that any other way to do it fast and don't use loop (in real case, I will deal with pretty big array many times, efficiency is a problem). Note that the high and low bytes array extracted from the original array with the module Split number.vi, but how can I combine these two array in one code with data arranged as high-low-high-low ... ? Thanks.
    You need to be more clear.
    Looking at the code, you are dealing with I16, not U16. Also your index array primitives could be replaced by autoindexing. Your use of the feedback node only makes sense if you want to append strings forever with stale data, thus growing data structures without limits. If you only want to convert the current data, remove the feedback mode and use a "concatenate strings" with a single input. A for loop is one of the most efficient data structures and using it is not a problem. One way or another the code needs top oerate on all data.
    All that said, I agree with Tim that most likely all you need to do is insert a typecast after the "to I16" and eliminate all other code.
    LabVIEW Champion . Do more with less code and in less time .

  • Two array objects compareTo:

    Have two arrays: ttt and ppp. I have to have a method to compare them.
    public int compareTo(object ob)
    both of the arrays are int type and both have super long numbers in them.
    Thanks

    Actually, the reflection api is pretty fast since
    JDK1.4.0...No. Reflection could not be fast. In J2SDK1.4 it seems to be faster then in previous releases. But improvments do not include array operations. So here are some results of simple benchmark:
    bash-2.05a$ /usr/java/jdk1.3.1_04/bin/java TestArray
    Result for reflect copiing (3 elements, 1000000 times): 4915ms
    Result for system copiing (3 elements, 1000000 times): 460ms
    Result for pure java copiing (3 elements, 1000000 times): 137ms
    bash-2.05a$
    bash-2.05a$ /usr/java/j2sdk1.4.0_01/bin/java TestArray
    Result for reflect copiing (3 elements, 1000000 times): 6082ms
    Result for system copiing (3 elements, 1000000 times): 491ms
    Result for pure java copiing (3 elements, 1000000 times): 115ms
    bash-2.05a$
    bash-2.05a$ /usr/java/j2sdk1.4.1/bin/java TestArray
    Result for reflect copiing (3 elements, 1000000 times): 5738ms
    Result for system copiing (3 elements, 1000000 times): 497ms
    Result for pure java copiing (3 elements, 1000000 times): 157ms
    bash-2.05a$
    As you can see, in new Java reflect operations on arrays are even slower then in jdk1.3.1. System copiing is good alternative for pure java (element by element) copiing, espetially for big arrays. And here is the code of this benchmark, test it on your PC also:
    import java.lang.reflect.*;
    public class TestArray {
        static void doNothing(){}
        static int field;
        public static void main(String[] args) throws Exception {
            final int COUNT = 3, TIMES = 1000*1000;
            final String[] arr1 = new String[COUNT];
            final String[] arr2 = new String[COUNT];
                long time = -System.currentTimeMillis();
                for(int i=TIMES; i-->0;)
                    copyReflect(arr1, arr2, COUNT);
                time += System.currentTimeMillis();
                System.out.println("Result for reflect copiing ("+COUNT+" elements, "+TIMES+" times): "+time+"ms");
                long time = -System.currentTimeMillis();
                for(int i=TIMES; i-->0;)
                    copySystem(arr1, arr2, COUNT);
                time += System.currentTimeMillis();
                System.out.println("Result for system copiing ("+COUNT+" elements, "+TIMES+" times): "+time+"ms");
                long time = -System.currentTimeMillis();
                for(int i=TIMES; i-->0;)
                    copyPureJava(arr1, arr2, COUNT);
                time += System.currentTimeMillis();
                System.out.println("Result for pure java copiing ("+COUNT+" elements, "+TIMES+" times): "+time+"ms");
        private static void copyReflect(Object src, Object dst, int count) {
            for(int i=count; i-->0; ) Array.set(dst, i, Array.get(src, i));
        private static void copySystem(Object src, Object dst, int count) {
            System.arraycopy(src, 0, dst, 0, count);
        private static void copyPureJava(String[] src, String[] dst, int count) {
            for(int i=count; i-->0; ) dst[i] = src;

  • A lot of time to multiply two arrays

    Hello!
    I want to multiply two arrays. The size of the two arrays is 1568x1568. I use to do it a AxB.vi block....but it spends a huge time, almost 17 seconds, when a operation like this have to be done it less than in a second.
    I 've attached an example of the multiplication of two arrays with this size, you have to wait 16 seconds to obatin the result.
    Someone know how i can do this multiplication as far as possible?I have to use another block.....for example....formula node and make iterations (or in this way you spend the same time?)
    Thank you very much
    Larson

    Nomis wrote:
    On my system (P4, 2.6GHz, 1GB Ram Win2K), the example runs in 19 seconds in LV7.0 but in 7.1 it runs in 300mS!
    No idea why - perhaps the AxB function was rewritten for 7.1
    Yes the matrix operations got a big makeover in LabVIEW 7.1 and are MUCH faster as demonstrated here.
    On my 1.6GHz PentiumM laptop, the difference is not that big, but still about 10x.
    LabVIEW 7.0: 3700ms
    LabVIEW 7.1: 360ms
    Time to upgrade!
    LabVIEW Champion . Do more with less code and in less time .

  • I accidentally added two .doc files, they show in iTunes file sharing, but don't show on iPad?

    I accidentally added two .doc files by dragging and dropping into itunes, under my device, then the app tab, then file sharing for Adobe Reader, they show in iTunes file sharing window, but don't show on iPad 3, and I cannot delete them on iTunes screen? Please help!

    First, I would advise you to apply Tao philosophy to this. Given the dysfunction of most software, if this was just an accidental copy and you don't want them on iPad and they are not showing up anyway, what's the problem? Forget it. It's not worth the hassles. I'm more concerned that you have psychological issues you need to be dealing with, not this. You are making much too unnecessary work and stress for yourself.
    As for deleting them, I'm assuming you highlighted them and hit delete and it didn't work. If not, it should. Works for me. But if it doesn't, my advice is also not to worry about it, as annoying as the clutter is. It will eventually resolve itself (like when your data files corrupt or your iPad crashes, LOL. (I apologize for my cynicism but I am fed up with dysfunctional software). It's not worth the hassles of trying to figure out petty issues.
    As for me, I have the opposite, and very serious problem. I've got Reader on my iPad too. But I can't move the pdfs out of it and onto my laptop with iTunes' dysfunctional file sharing. I get the error "file cannot be copied because you do not have permission to see its contents." I have hundreds of pdfs on my iPad that I converted from web surfing with other programs that also don't work and I can't get them off the iPad for backup and to have a synced library I can access from both laptop and iPad.
    I called iTunes twice and both times they blamed it on the app, saying iTunes file sharing doesn't support third party apps and that I should call Adobe and talk them into writing the code that will work with iTunes. Yeah, right. And Reader is not the only problem. This is happening with iAnnotate and Write PDF and other apps.
    I suspect that both of us have the root problem, perhaps Apple's greedy refusal to support the apps that it sells in the app store and are quasi-integrated enough to show up in the file sharing documents list, but can't be moved or deleted; and the apps that don't bother to make their apps fully work with iTunes file sharing.
    If anyone has any solutions ......

Maybe you are looking for