Divide an array into components

Hello:
I am developing a LV application that has, in some way, "two parts": One of them is the user interface and its associated block diagram, that receives values from controls and files. Then, this values are used for feeding the inputs of a "Call Library Function" node.
Well, some of the values I use are components of an array. I thought that I could use a "Split array" block, but I cant connect the "1 component array" with the numerical input of the library node.
How could I "convert" a "1 component array" into a "numerical value". I actually use a very improper method, I connect the "1 component" array to a "array max & min" block, and I use "max value" output (I could use min too, obviously).
Another question that is related to this is the follwing: Is there any method in order to split an array into its numerical components? Because I have, for example, a 4 elements array, I wished to divide it (in an easy way, instead of having a "serial association" of 4 "split array" blocks) into 4 numerical values that are used for feeding a function node.
Well, if you need any aditional info, please dont hesitate in ask for it. Thank you very much for your attention and please sorry for my bad english.
Yours sincerely.
Juan Crespo

Juan,
Apologies if I misunderstood, but is the 'Index Array' function the answer to both your questions?
=====================================================
Fading out. " ... J. Arthur Rank on gong."
Attachments:
Index Array Elements.jpg ‏12 KB

Similar Messages

  • Breaking up an App into components

    I have an App in deployment which displays a dashboard
    program divided into several tabs, one tab contains a treemap,
    another has four charts, another has one big chart, another has
    five dials, etc. etc. currently this is all coded into one big App.
    What I want to do now is break this up into either MXML or AS
    components so that it will be more managable and more modular. I
    want to make a 'shell' master program with the tabs, and then
    import the other pieces as modules.
    I have managed to separate out one of my most complex pieces
    from my original main App, one of the Treemaps, and I want to now
    import that as a component of my "shell". Can someone reccomend a
    technote or a web page I could look at to learn how to do this? I'd
    also like to learn some things like how do you 'talk to' variables
    within a particular component that you import in, or is that even
    possible?
    M.

    Is this even the best practice? Should you break an app into
    components? Or is it better to just leave it all in one App?
    I found this example of using code behind to extent the
    ActionScript class, is this the best way to aproach breaking an app
    up?
    http://www.adobe.com/devnet/flex/quickstart/building_components_using_code_behind/

  • Possible to insert array into db without looping?

    Hi there,
    I'm working on a Flex project that uses cfc's and MySQL. I
    have an ArrayCollection that I want to store in my db. I was
    thinking that I could store it as a BLOB. I'm taking a stab at it
    now but I thought I'd put the feelers out to see if anyone has any
    ideas of how to do this.
    Maybe a simpler way to put it:
    Is it possible to save an entire array into a database
    without looping through and storing each item in the array
    separately?
    Thanks.
    Novian

    For 1 dimensional arrays, you can either convert the array to
    a list - ArrayToList() or for more complicated structures you can
    serialize your data using XML, WDDX (a type of XML) or JSON. WDDX
    support is native to CF, you can find components online that will
    give you JSON support or you can roll your own XML
    conversion.

  • Divide a number into random parts

    I need to divide a number into a collection of random parts. So that the sum of all parts is equal to the number.
    E.g.:
    public void divideRandomly ( int number, int parts)
    int[] returnArray = new int[parts];
    //do random division calculations
    return returnArray;
    Lets say the number = 20
    And parts = 4
    I would then like to return an array of ints containing e.g. 3, 11, 5, 1
    OR e.g. 4,8,2,6
    Does anyone have a clue as to how I could do this?
    Cheers

    Be aware that given the wrong parameters this solution
    can take a long time to find a list. This seems misleading, as the termination condition is based
    on randomness. Although, it is possible to predict an average
    termination time.
    Basically your algorithm starts by generating initial random values
    in the range [0, maxValue]. You limit the size of the maximum
    generated value, although I'm not sure why. Obviously maxValue
    has to be greater than sum / length, otherwise it would be
    impossible to generate any combination values that add up to sum.
    Then your algorithm asks if the sum of those initial random values
    is equal to the target sum. If not, you cycle through the list replacing
    the the current position with a new random value and updating the
    current sum.
    As an example, let's suppose that maxValue is equal to sum, and
    that sum = 1000, and length (numParts) is 4.
    Assuming the minValue is 1, not 0, then the total number of
    permutations of 4 numbers that add up to 1000 is:
    165,668,499
    However, the total number of permutations is:
    1000^4 = 1,000,000,000,000
    In terms of probability, the chance of finding a solution on each try is:
    165,668,499 / 1,000,000,000,000 = 0.000165668499
    Thus, you'll need approximately 6036 loops on average to find a solution for 1,000 split 4 ways.
    For 2,000 split 4 ways, number of perms is:
    2000^4 = 16,000,000,000,000
    The perms of 4 numbers that add up to 2000 is:
    1,329,336,999
    Probability of finding a solution on each try is:
    0.0000830835624375
    Average number of tries is: 12036
    I'm impressed that the random approach is that fast.

  • Need a little help trying to convert an array into a cluster..

    I'm having a difficulty converting the output of the AI Acquire Waveforms.vi from an array into a cluster. On my display panel I have a radial termperature gauge with two needles displaying the temperature of two different inputs. The input to this radial guage is of the cluster type, hence the need to convert.
    Any help is appreciated. Heck even if there is a better way let me know.

    The output of "AI Acquire Waveforms.vi" is an array of waveforms (waveform data type). You must first isolate the two elements of that array that correspond with the channels to which your temperature sensing devices are wired. If those are the only channels in your scan list, then the array should only be two elements in size. You can apply a shortcut if that is the case, but first the general solution.
    1) Index the array of waveforms with an Index Array function found in the Array pallette. Stretch the Index Array function so that it gives you two inputs and outputs. Wire the index of the first and second temperature channels to the bottom inputs of the Index Array function. Wire the output of "AI Acquire Waveforms.vi" to the top input of the Ind
    ex Array function. The outputs of the Index Array function are each a waveform for the corresponding channel you selected.
    2) Get the "Y" waveform component for each channel. Use the Get Waveform Components function in the Waveform pallette. It looks alot like an unbundle function. Get two of those guys and wire then to each of your outputs from the Index Array function. Select "Y" for each Waveform component.
    3) Average (or otherwise reduce) the acquired signals. The output of the "Y" component is an array of floats. You can wire that array up to an Average function to give you a scalar value. Do that for each output and now you just have two numbers.
    4) Bundle your numbers. Use the bundle function.
    5) Wire the bundle to your indicator.
    Enjoy,
    Daniel L. Press
    www.primetest.com

  • Inserting a associative array into a table

    Hi,
    I am working on a process where I want to store the temporary results in an associative array. At the end of the process I plan to write the contents of the array into a table that has the same structure. (the array is defined as a %rowtype of the table)
    Is it possible to execute ONE sql statement that transfers the array into the table? I am on 10g (10.2.0.4.0)
    Here's what I have now:
    declare
      type t_emp is table of emp%rowtype index by pls_integer;
      v_emp t_emp;
    begin
      -- a process that fills v_emp with lots of data
      for i in v_emp.first .. v_emp.last
      loop
        insert into emp values v_emp(i);
      end loop;  
    end;But it would be better if the loop could be replaced by sql one statement that inserts all of v_emp into emp. Is that possible?
    Thanks!
    PS: I'm not sure whether it's a good idea to use this approach... building a table in memory and inserting it into the database at the end of the process. Maybe it's better to insert every record directly into the table... but in any case I'm curious to see if it is possible in theory :)
    Edited: Added version info

    True, SQL cannot access the PL/SQL type.
    So you can not do something like this:
    insert into emp
    select * from table(v_emp)That is not possible.
    But FORALL is possible:
    FORALL i in v_emp.first .. v_emp.last
        insert into emp values v_emp(i);FORALL makes just one "round trip" to SQL bulk binding the entire contents of the array.
    It is much more efficient than the normal FOR loop, though it is mostly a PL/SQL optimization - even the FORALL actually inserts the rows "one at the time", it just hands the entire array to the SQL engine in one go.
    If the logic has to be done procedurally, FORALL is efficient.
    If the logic can be changed so arrays can be avoided completely and everything done in a single "insert into ... select ..." statement, that is the most efficient.

  • How can i pass a value in array into .setText()?

    i want to display a value in an array into a JTextField. May i know how to do it?
    eg:
    JTextField UserName;
    UserName.setText(s);
    but it doesn't display the value into the JTextfield.

    ok... is s an array?
    String[] s = {"s1", "s2"};Either you expect 1 value...
    username.setText(s[0]);
    // or
    username.setText(s[1]);Or you expect both:
    StringBuffer sb = new StringBuffer("");
    for(int x = 0; x < s.length; x++) {
       if(x != 0) sb.append(", ");
       sb.append(s[x])
    username.setText(sb.toString());

  • Add time stamp array into first column of text file

    I am writing daq output to a file by using array to spreadsheet string vi then write that to a file but I would like to add a time stamp array into the first column of the text file. How do I do this?

    When you use a DAQmx Read, you have the option of returning a waveform data type. This includes time data. If you were to use this and either Export Waveforms to Spreadsheet File or Write Measurement File, this would included. To stick with the regular Write to Spreadsheet File, you would have to create an array of timestamps yourself based on a start time and the sample rate of the DAQ. Then you would convert this and the data array to strings and use the string array type of Write to Spreadsheet instead of the DBL type.
    Message Edited by Dennis Knutson on 09-25-2007 01:12 PM
    Attachments:
    Write to Spreadsheet - Strings.PNG ‏1 KB

  • Write arrays into a text file in different columns at different times

    Hi,
              I have a problem write data into a text file. I want to write 4 1D arrays into a text file. The problem is that I need to write it at different time and in different column (in other word, not only append the arrays).
    Do you have an idea to solve my problem?
    Thank you

    A file is long a linear string of data (text). In order ro insert columns, you need to rewrite the entire file, because colums are interlaced over the entire lenght of the file.
    So:
    read file into 2D array
    insert columns using array operations
    write resulting 2D array to file again.
    (Only if your colums are guaranteed to be fixed width AND you know the final number of colums, you could write the missing columns as spaces and then overwrite later. Still, it will be painful and inefficient, because column data are not adjacent in the file.)
    LabVIEW Champion . Do more with less code and in less time .

  • How To Divide Source File Into Smaller Files Without Exporting?

    Hello Everyone,
    I'm a beginner with PPro CS4 and to video editing in general. I've done a lot of Googling and searching of these forums to get an answer to this question, but I haven't found a clear answer. Here's my problem:
    I have many hours of HDV footage shot over the past few years with a Canon HV30. This footage is on dozens of DV tape cassettes. I want to capture most of it to disk.
    When I capture a tape to disk, I get a single large mpeg4 file. (PPro captures all HDV footage to mpeg4.) "Scene select" doesn't work with the HV30, so my only other way to make smaller capture files would be to set In/Out points with batch capture. But this would mean hours of fast-forwarding and reversing with the VCR-like controls on the camera to review all the tapes and set the points. I thought it might be FASTER to simply capture an entire tape in one operation, THEN review the captured tape within PPro (it's much faster using the scrubber), and dividing that file into smaller files within PPro, thereby avoiding all the mechanical fast-forwarding and rewinding on the camera itself.
    But the only way I can find to do this seems to involve EXPORTING clips. Am I wrong to think that exporting a clip to a new file involves a degradation of the original mpeg4 source file? Or will there be no loss to the quality if I simply export to mpeg4 format?
    It seems there should be an easy way to simply divide the original capture into smaller source files for later editing, without putting the footage through another generation of processing (exporting), which might entail some loss of quality. Or am I wrong about this?
    (CS4 Master Suite, i7 3630k, 16GB RAM, C: 256GB SSD, D: 1T Setpoint F3, E: 1T Setpoint F3)

    HDV footage is mpeg2 (whats in a number ). CS4 does not do scene detect you need to use HDV split for that.
    http://strony.aster.pl/paviko/hdvsplit.htm.
    You can run your already captured files through hdv split and it will chop the file into clips and off you go.

  • Converting object wrapper type array into equivalent primary type array

    Hi All!
    My question is how to convert object wrapper type array into equivalent prime type array, e.g. Integer[] -> int[] or Float[] -> float[] etc.
    Is sound like a trivial task however the problem is that I do not know the type I work with. To understand what I mean, please read the following code -
    //Method signature
    Object createArray( Class clazz, String value ) throws Exception;
    //and usage should be as follows:
    Object arr = createArray( Integer.class, "2%%3%%4" );
    //"arr" will be passed as a parameter of a method again via reflection
    public void compute( Object... args ) {
        a = (int[])args[0];
    //or
    Object arr = createArray( Double.class, "2%%3%%4" );
    public void compute( Object... args ) {
        b = (double[])args[0];
    //and the method implementation -
    Object createArray( Class clazz, String value ) throws Exception {
         String[] split = value.split( "%%" );
         //create array, e.g. Integer[] or Double[] etc.
         Object[] o = (Object[])Array.newInstance( clazz, split.length );
         //fill the array with parsed values, on parse error exception will be thrown
         for (int i = 0; i < split.length; i++) {
              Method meth = clazz.getMethod( "valueOf", new Class[]{ String.class });
              o[i] = meth.invoke( null, new Object[]{ split[i] });
         //here convert Object[] to Object of type int[] or double[] etc...
         /* and return that object*/
         //NB!!! I want to avoid the following code:
         if( o instanceof Integer[] ) {
              int[] ar = new int[o.length];
              for (int i = 0; i < o.length; i++) {
                   ar[i] = (Integer)o;
              return ar;
         } else if( o instanceof Double[] ) {
         //...repeat "else if" for all primary types... :(
         return null;
    Unfortunately I was unable to find any useful method in Java API (I work with 1.5).
    Did I make myself clear? :)
    Thanks in advance,
    Pavel Grigorenko

    I think I've found the answer myself ;-)
    Never thought I could use something like int.class or double.class,
    so the next statement holds int[] q = (int[])Array.newInstance( int.class, 2 );
    and the easy solution is the following -
    Object primeArray = Array.newInstance( token.getPrimeClass(), split.length );
    for (int j = 0; j < split.length; j++) {
         Method meth = clazz.getMethod( "valueOf", new Class[]{ String.class });
         Object val = meth.invoke( null, new Object[]{ split[j] });
         Array.set( primeArray, j, val );
    }where "token.getPrimeClass()" return appropriate Class, i.e. int.class, float.class etc.

  • How do I modify an Array into a collection

    Hi I'm havin a real hard time modifying an Array into a collection, heres the code I'm working with
    I have to modify all the Arrays of this code....
    public class Student {
         private String           name;
         private float []      grades;
         private int           finalGrade;
         public Student(String name) {
              this.name      = name;
              this.grades = new float[5];
              for (int i = 0; i < grades.length; i ++) {
                   grades[i] = 0.0f;
              finalGrade = 0;
         public String toString() {
              String studentInfo = " Grades for " + name + ": ";
         for (int i = 0; i < grades.length; i ++)
         studentInfo += " " + grades;
         studentInfo += "\n final grade: " + getFinalGrade();
         return studentInfo;
         private void setFinalGrade() {
              float temp = 0.0f;
              for(int i = 0; i < grades.length; i++)
                   temp += grades[i];
              finalGrade = Math.round(temp/grades.length);
         public int getFinalGrade() {
              this.setFinalGrade();
              return finalGrade;
         public void setGrade( int index, float grade) {
              this.grades[index] = grade;
         public float[] getGrades() {
              return grades;
         public String getName() {
              return name;

    I'm kind of new at this I just started to learn about
    that, is there an example u could give me to inspire
    me ?
    Object[] o = new String[]{"one", "two", "five"};
    Collection ascollection = Arrays.asList(o);
    //the returned Collection (List) is unmodifiable,
    //so if we want to remove or add items, we need
    //a copy:
    Collection copy = new ArrayList(ascollection);
    copy.remove("two");
    String[] backagain = (String[]) copy.toArray(new String[copy.size()]);

  • How do I combine two arrays into one?

    I am trying to combine two byte arrays into one. What function do I use that will put in the information in the same order just combined?

    battler. wrote:
    Julien,
    Used LV for years.  Never knew that (concatenate inputs).  Wouldn't believe the lengths ive used to get around it.  Thanks
    Same here! I actually learned about it taking a sample test for the CLAD.
    Richard

  • Passing array into resultset

    hi,
    is it possible to pass an array into a resultset? if yes please indicate how.
    thank you all in advance

    Hi,
    Sorry for the confusion, here's what I'm trying to accomplish.
    I'm trying to create a report in Crystal Report and use Java as data source. My Java application needs to generate some value and pass them to the report as parameters. After some research I've found that I can use a Java Bean class as data source for Crystal Report that returns a ResultSet. Therefore I'm trying to pass some values in my Java app into the Bean class as array and convert them to a ResultSet for Crystal Report.
    If you know of a different way please let me know, otherwise, this is what I meant by passing array into resultset.
    thanks for your reply,

  • I have old video clips in Photoshop Elements Organizer v12 for Mac.  I want to divide some of those clips in Organizer.  I can do that in Premiere Elements 12 and save them as "Projects" - but how do I get the divided clips back into Organizer?

    I have old video clips in Photoshop Elements Organizer v12 for Mac.  I want to divide some of those single clips into 2 or 3 separate clips, each shown separately in Organizer.  I can divide the clips in Premiere Elements Editor 12 and save them as "Projects" - but I can't find any way to get those divided clips back into Organizer.  Does anyone know whether that can be done?  Many thanks for your thoughts.

    What about Google Drive? And just share the folder with the family members.
    Erick

Maybe you are looking for

  • Where is the documentation of the options on the 'System Services' settings screen?

    The settings screen Settings ▸ Location Services ▸ System Services in iOS 5.0 contains the following boolean options: Cell Network Search Compass Calibration Diagnostics & Usage Location-Based iAds Setting Time Zone Traffic I have never used an iPhon

  • N97 access point options

    Is it possible to set my n97 so that whenever it is in the range of my home wireless network it uses that for access instead of 3G network?  e.g. for when it checks email or uses facebook etc?  I was reading about the access groups in the manual but

  • TextInput box maximumLength does not allow to lose focus

    Hello, I have a textInput box with a maximumLength set to 4000. I want it to prevent the user to put any values past 4000 characters. It does stop the user right at 4000, however if there are 4000 characters in the box, the user cannot click out of t

  • Switch membership from one year to student

    i am currently on a year membership and would like to switxch to student...can i do this and how??

  • RectVisible function not working as before on Windows 8

    What I want to achieve (and did successfully before switching to win8.1) is to check whether the currently displayed windows (i.e. not minimized)  visible parts (to the user) are crossing a selection rectangle I manages. For that purpose I used to us