1D Index Array Extraction

Hey all,
I'm relatively new to using LabView and cannot figure out how to get this done.
I have 2 arrays, aray A and array B. I want to look up the specific values from Array B by analyzing Array A first and noting what locations, indexes, they are. 
From Array A I am able to locate the locations, but it is in the form of a 1-D array of double. Now that I know the indexes of locations in interest,how do I extract the data from Array B? 
When I try to use Index Array LabView gives the following error, 'source is 1-D array and sink is long'. Any help would be greately appreciated on how I can extract the data points from Array B by having an array of indexes of interest.
Example of what I'm trying to do
Input:
Locations / Indexes: 1  3  4
Waveform Array: 0  2   4  6  8  10
Output:
0  4  6 
Thank you for your time
Solved!
Go to Solution.
Attachments:
progress.vi ‏28 KB

Arrays are 0 indexed so locations 1,3, & 4 should be 0, 2 & 3 if you want those output values.  Attached is a pic of the code to do this. Be sure to disbale indexing on the data set and allow indexing on the 'location/indices' array. 
Attachments:
ex code.png ‏17 KB
ex code.jpg ‏41 KB

Similar Messages

  • Incrementing 'index array' row input according to bytes received

    I am receiving binary data through a UDP port. I'm reading a column of a spreadsheet and I want to extract the consecutive row everytime a further 4 bytes of data is received. I will use the contents of the spreadhseet cell as a condition to format the binary data. I guess i need to count the bytes of data passed then reset the counter every time it reaches 4. Every time the counter resets the index array contant need to increment by 1...but i don't know how to do this. Can anyone help?  
    Thanks

    I tried as you said, it seems to be partially working but there seems to be a problem with the timing. The index increments in steps of one but not quickly enough. The data type sent to the selector terminal does not seem to be in sync with the binary data as my data does not update as i expect. Any ideas how to fix this problem?
    vi attached...
    Attachments:
    UDP_Case_Struct.vi ‏35 KB

  • Index array is not getting new values from DAQ

    I am measuring force values with my DAQ card and these values are always changing.  However, in my programming something is not working right with the way I have things set up.  After my DAQ I have a "Convert to Dynamic Data" and after that I have an "Index Array".  When the program is executing and I turn on the highlight option I do not get changing force values after the "Convert to Dynamic Data" and therefore no changing force values enter my "Index Array".  Whaterever the first value is that gets passed to the "Convert to Dynamic Data" is the only value that I get for the remainder of the program.  I tried plugging in an indicator between the DAQ and the "Convert to Dynamic Data" and it did show varying values.  Please help with my program.  I have tried messing with the properties of the "Convert to Dynamic Data" and nothing has worked.  I am stuck and cannot see how to fix this problem.  I have attached my program as it is currently put together.
    Thank You In Advance,
    Gabe.
    Attachments:
    Actuator_Gabe_Oct27_Flat_Sequence_XY_+Measurement_File.vi ‏131 KB

    Please know that the best option is to review the concepts discussed to further understand programming in LabVIEW.  Perhaps you could take a look through ni.com/gettingstarted and ni.com/lv101 to have a look at some of the online help materials.  I have included a VI snippet of the while loop containing the changes.  Further, the code you attached contains a lot of customer controls and VIs, which are not common to all LabVIEW users.  It is a best practice to only attach the code of value to the question/post, and to have the most simplified version of the problem.
    Best,
    Adam
    Academic Product Manager
    National Intruments

  • How do I correct a build error while saving "Calculate Color Index Array.vi"?

    I have an application that takes some data and then periodically generates a nifty 3d graph.  When trying to compile this application to run on a stand-alone machine, i get an error message that crashes the build.  This is the information that is generated for the error:
    An error occurred while saving the following file:
    C:\National Instruments\LabVIEW 2009\vi.lib\Math Plots\3D Math Plots\3D Surface\3D Surface Datatype\Protected\Create Plot Data\Calculate Color Index Array.vi
    Invoke Node in AB_Source_VI.lvclass:Close_Reference.vi->AB_Build.lvclass:Copy_Files.vi->AB_Application.lvclass:Copy_Files.vi->AB_EXE.lvclass:Copy_Files.vi->AB_Build.lvclass:Build.vi->AB_Application.lvclass:Build.vi->AB_EXE.lvclass:Build.vi->AB_Build.lvclass:Build_from_Wizard.vi->AB_UI_Frmwk_Build.lvclass:Build.vi->AB_UI_FRAMEWORK.vi->AB_Item_OnDoProperties.vi->AB_Item_OnDoProperties.vi.ProxyCaller
    <APPEND>
    Method Name: <b>Save:Target Instrument</b>
    Details: 
    Error 6 occurred at AB_Source_VI.lvclass:Close_Reference.vi -> AB_Build.lvclass:Copy_Files.vi -> AB_Application.lvclass:Copy_Files.vi -> AB_EXE.lvclass:Copy_Files.vi -> AB_Build.lvclass:Build.vi -> AB_Application.lvclass:Build.vi -> AB_EXE.lvclass:Build.vi -> AB_Build.lvclass:Build_from_Wizard.vi -> AB_UI_Frmwk_Build.lvclass:Build.vi -> AB_UI_FRAMEWORK.vi -> AB_Item_OnDoProperties.vi -> AB_Item_OnDoProperties.vi.ProxyCaller
    Can anyone help me understand why the 3D Surface Datatype.lvclass keeps booching on my compile?
    Thanks!

    Check this

  • How can I create sub-arrays based on the positions of indicies in a separate index array?

    Please forgive me if this question is basic or obvious. I am fairly new to LabVIEW and I'm trying to learn as I go along.
    I have a 1D array of index values (the number of possible index values is not fixed, but can vary between uses of the application; it could be just {0, 1} on one day and {1, 5, 11, 678} on another) and a 1D array of measurement values (doubles). I'd like to parse the measurement values into sub-arrays for each index, so that if my index array was:
    [0 1 1 1 1 5 5 0 5 5 1 0 1 1 5]
    and my measurement array was:
    [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 0.10 0.11 0.12 0.13 0.14 0.15]
    I would get back 3 sub-arrays:
    [0.1 0.8 0.12]
    [0.2 0.3 0.4 0.5 0.11 0.13 0.14]
    [0.6 0.7 0.9 0.10 0.15]
    I know there must be a simple way to do this, I guess I'm just stuck too much in matlab-array thinking to figure it out... please help!
    -- jph
    Solved!
    Go to Solution.

    jamespherman wrote:
    Thus, I figured it might be possible to generalize this idea and send multiple sets of XY values to an XY graph.
    OK, all we need is a trivial modification of what we already have. XY graph data is easiest handled using complex data. Here's a quick rewrite. See if this works for you.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    SplitInGroupsGraph.vi ‏14 KB

  • Create sub-arrays based on the positions of indicies in a separate index array?

     I have a 1D array of index values and a 1D array of measured values. As an example:
    Index array: 1, 2, 4, 7, 126, 127,129, 214, 215
    Measurement array: 5, 6, 8, 4, 4, 9, 8, 7, 5 
    I want to get sub-arrays of measurement array (three for this example):
    [5,6,8,4], [4,9,8],[7,5]
    A sub-array is generated when there is a big gap (this value is known) between consecutive elements of Index array (126-7, 214-129, this value is known, say 80).
    How to do this in labview.
    Thanks
    Solved!
    Go to Solution.

    Alice12 wrote:
    I tried to generate your program but there is some problem (I dont know the false case).
    And I want to find the maxima of each sub-array and then find their average (this should be the final output).
    You have it mostly right.  I explained in my post what's in the false case: an increment (+1) for the top shift register.  The other wires pass straight through.  The image I posted is a "snippet" - it's actual code.  You can drag it into a block diagram (with some web browsers, you will need to drag to your desktop first, and from there to the block diagram).  There is a bug in the snippet creation where it does not always show cluster contents properly, and that's what happened here.  The array constant wired to the left side of the lower shift register contains a cluster containing an array of numeric values.  You will see this if you load the snippet.  I hope that you were able to understand the logic of this code as you were constructing it, but if not, please ask for an explanation.
    From there it is trivial to find the max and averages.  Connect the output of my code to a for loop.  Inside the for loop, unbundle the array, and compute the maximum and average.  Functions to do these operations on any numeric array already exist (look for Array Max & Min, and Mean).

  • How to index array in a for loop

    i'm connecting from variant-to-data function to an index array function inside a for_loop (refer to attachment).  the data-type wire got converted from Table(2-D array) to Table(1-D array).  How do I keep it from converting to 1-D array?
    Attachments:
    arrayI.doc ‏146 KB

    Of course it seems you want to run the loop once for each row in the 2D array, so many times autoindexing is the better solution!
    You are using an "index array" inside the loop. If you are planning to wire the index to the iteration [i] terminal (who knows? ), you might as well use autoindexing. This way you don't need to wire N (the loop will know how many rows there are) and you don't need to use index array inside the loop.
    The image shows two functionally equivalent code fragments. Autoindexing (bottom) is much simpler than explicit indexing (top). See if autoindexing can work in your case.
    Since you are a LabVIEW beginner, you should try to stay way from stacked sequences and local variables. They are rarely needed and can ofter cause problems such as race conditions and unreadable code.
    Message Edited by altenbach on 03-31-2008 04:17 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    autoindexing.png ‏8 KB

  • How to implement index array inside case structure for searching a 3D array?

    Well I have a 3D array and I want to index certain elements from that array. And I have thought of one way of doing this is to have multiple index array functions on the block diagram to search the array simultaneously, but that would be messy. Or I could setup some kind of case structure and place each index array function into individual cases. I've tried the latter, but when I connect the 3D array to the case structure at the"?" it doesn't give me permission because it says I'm hooking up two different types of data. Case Structure is for T or F and 3D array is not a boolean.
    So how can I setup the Case Structure to work for a 3D array?

    A case structure's selection tunnel cannot accept an array.  What exactly are your search criteria?  It sounds like a few FOR loops will be needed.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Indexing array without a loop

    I would like to make and insert elements to each index on an 1D array. but, I don't want to use loop. How can I input my data into 1D array increasing and indexing array? whenever We want to make a new array, Do We have to use a loop control?

    To create an array, all you have to use is the Initialize Array function or just drop an array constant onto the diagram. You can then use either Replace Array Subset or Insert Into Array.

  • Initialize indexes array

    Hello!
    I am new to LabView and  I am struggling with this problem for a couple of days...
    I have a 2D array CH x spike_time and on each row (1D array) I need to implement a logic that requires the possibility to dynamically initialize two indexes.  
    To be more clear, if I indicate with CH each row of the 2D array, this is the logic I should implement on each row:
    i=0;
    while i <= N-min_burst_size
    {  j=i+1;
       while ch(j) AND ch(i)-ch(j) <= Inter_spke_interval AND j <= N-1
        {j=j+1;}
        if j-i+1 >= min_burst_size then save(i,j); 
        i=j;
    What is the best way to implement this logic in labview?
    How can I manipulate the value of the indxes i and j to initialize them as in the code? I tried to use the "Subset of Array" function in order to "cut" subset of the row starting from i and j and shift registers to pass the subset again as input of the loop, but I couldn't get to anywhere close to a solution.
    If anyone could share some ideas with me or has a useful similar vi, I would be very thankful!
    Thank you so much!
    Solved!
    Go to Solution.

    MG70 wrote:
    Thank you Hoovahh and GerdW for helping me!!
    No problem.  In the spirit of teaching I'd like to teach you another trick on the forums.  The large majority of us work on these forums for free, and the recognition we get partialy comes from the number of posts we are able to answer, and the number of kudos we get for helping others.  So feel free to give kudos to those that help you, and mark topics solved by a post that solves your question.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • Indexing array of references element by element

    Hello,
    I have a simple question. How do I go about indexing an array of references element by element? For example, when using a cluster reference, there is a property node called "controls [ ]" that we can pass into a for loop. For a normal array, "enable indexing" is usually automatically turned on when entering a for loop. Why is it that for an array of references, this is not the case? Thanks for the help.
    Solved!
    Go to Solution.
    Attachments:
    array_of_references.JPG ‏35 KB

    Since the Get Image is a method, it has to work on something, and that would be a picture control or indicator.  (If you look at the Get Image Method for the array, you'll notice it only returns an image of the front panel object, so I think you'd just get a picture of the array as it looks on the FP).
    So you'd send the picture to an indicator, then use the Get image method on that indicator immediately afterwards.  See attached.  I didn't try this out so I can't be sure it would work, but I think it would.  But it would still be a major hack compared to just using the Picture to Pixmap VI.
    Message Edited by Ravens Fan on 03-27-2009 01:03 AM
    Attachments:
    Array_of_References[1]_BD.png ‏12 KB

  • Shift Register while Indexing Arrays in Formula Node

    Hello, 
    I am having trouble using the formula node while indexing my two arrays.  I keep getting "NaN" for my output array. I believe the problem lies within my shift register.  My guess is that for the first calculation there is not a PreviousAngle so that is why it is giving me "NaN."  For the first index I would like the value of the PreviousAngle to be 0. I am new to LabView and unsure what to do.
    Thanks!
    Christian Seymour
    Solved!
    Go to Solution.
    Attachments:
    Complementary Filter.vi ‏21 KB

    The shift register should contain 0 by default since you are using a double [if uninitalized, the shfit register takes the default value of the data type.  In this case, the default Double is 0], but you should explicitly initalize the shift register to a default value in most cases.
    To do so, right click on the "previous angle" shift register and select "Create constant".  This will create a Double value of 0 to fill in the register for the first calculation.
    If you need a number other than 0 to start, you can just change this constant.
    **Note:  This is a good habit to have.  Shift registers retain value as long as the VI is in memory.  So if you run this more than once, it will have the value from the last execution automatically!  This is usually unintended behavior for new LabVIEW users -- however you can sometimes take advantage of this feature in some applications and make it intended behavior
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    If someone helped you out, please select their post as the solution and/or give them Kudos!

  • "You have connected two terminals of different types" Index Array won't work

    So I have a 3D array finally. Now I want to index that array and display the contents of a certain element on a new array. When I index a 2D array, this method works just fine. But when I change it to 3D array, Labview gives me the following error:
    You have connected two terminals of different types. The type of the source is string. The of the sink is 1D array of string.
    So I'm assuming the 1D arry it speaks of is referring to the indicator array that the index should spout out the contents of the element I'm looking for. And the source string is the 3D array. I've tried changing the dimensions of the 1D array to match that of the source 3D array, but nothing is working yet. I've attached a pic of the problem below.
    Attachments:
    LVerror.JPG ‏20 KB

    This might be another problem of understanding what the data represents.  You are telling the code that you have a 3D array, and you want to pull out a single element, a scalar string, by specifying the row, the column and the page to find the data.  But then you are trying to display this single item into a indicator that is a 1D array.  You are trying to display a single cell of data, into a column of data.  Either replace your 1D array with a scalar string, or when you index your array specify a row or column to display.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • Crash when use indexe array with in place element structure

    Hello !
    I have a problem with in place element structure. I want index a waveform array (16 elements) and when i execute or save that labview close....
    I dont have problem with waveform array 15 elements or less, but i need index 16 elements...
    Thanks for your help !!!
    Solved!
    Go to Solution.
    Attachments:
    Test.PNG ‏8 KB

    I give you my code but it work because i used a waveform array with only 15 elements. I can't save or execute with 16 elements...
    So add it (like picture Test.png) and you will see.
    Thank you
    Attachments:
    Test.vi ‏25 KB

  • Dynamic index arrays BPEL

    Hi,
    What I am doing wrong below. I am trying to dynamic access index of array in BPEL.
    <assign name="InitializeLoopCounter">
    <copy>
    *<from expression="1"/>*
    *<to variable="loopCounter"/>* </copy>
    </assign>
    <while name="While1"
    condition="bpws:getVariableData('loopCounter') &lt; ora:countNodes('RetrieveEventSummary_GetEventSummary_OutputVariable','part','/ns1:GetEventSummaryResponse/AgencyEventSummary')">
    <sequence name="Sequence2">
    <assign name="AssignAgencyEventId">
    <copy>
    *<from expression="bpws:getVariableData('RetrieveEventSummary_GetEventSummary_OutputVariable','part','/ns1:GetEventSummaryResponse/AgencyEventSummary[position()=bpws:getVariableData('loopCounter')]/AgencyEventId')"/>* <to variable="RetrieveEventDetail_GetEventDetail_InputVariable"
    part="part"
    query="/ns1:GetEventDetailRequest/AgencyEventId"/>
    </copy>
    </assign>
    <invoke name="RetrieveEventDetail" partnerLink="CadDataService"
    portType="ns1:Cad" operation="GetEventDetail"
    inputVariable="RetrieveEventDetail_GetEventDetail_InputVariable"
    outputVariable="RetrieveEventDetail_GetEventDetail_OutputVariable"
    bpelx:invokeAsDetail="no"/>
    </sequence>
    </while>
    Thanks
    Edited by: user5108636 on 13/07/2011 22:49
    Edited by: user5108636 on 13/07/2011 22:49

    answered in:
    Bind variables in SQL query of DBAdapter

Maybe you are looking for

  • Need help asap, project due on monday!

    Hey everyone, I'm a college student and I have a final project due on monday.  I'm running into a MAJOR issue which I've never had before. I have text on it's own layer, typed it directly into flash, there are two text fields on this layer.  I create

  • Module load order

    Since kernel 3.4 I get this error at boot time: Errata AE18 not fixed, update BIOS or microcode of the CPU! the microcode update module is listed in /etc/rc.conf but it is loaded *after* coretemp. How do I change the order modules get loaded?

  • External hard drive not detecting

    Hello, I have installed Win 8 to my system which is having a 2.5GHz processor. That's fine. But When I am connecting, an External SATA I hard drive through enclosure, Its not detecting. But It is able to detect all other external hard drives. please

  • How to install the Canon IR C4580 using OSX 10.6.6

    We have a Canon IR C4580 at the office hooked up to the network. For the life of me I cannot install the printer to my new laptop, although it works fine on my old G4 desktop as the driver was installed on a previous version of OSX, now running on 10

  • Speedgrade and "Bleach bypass" effect

    I'm editing in PP and direct linked to SG.  I have applied the Bleach Bypass effect in SG, and it looks killer on this one shot I have, but when I direct link back to PP, the effect is NOT there.  It shows up as a "lumetri effect" under the effects t