Index 2d array

Hi, I'm new to LabVIEW and I'm a bit stuck. I have a matrix that represents the grid of a table. Each part of the grid represents a section of the table that I would like to turn a valve on and off for. I have created a 2D array with the inputs for the valves. I have LabVIEW set up so that I have the array. However, I don't know how to assign the different positions in the array to the different valves (I already have the valves imported). I have looked at the index tool, but I don't understand how to use it for 2D arrays, nor do I understand how to create multiple outputs from the single index block. There are 128 ports, so if there is a way to automate the process, that would be preferable.

If you want to index a single elements of a 2D array, you need to wire both indices, else you get and entire row or column.
It is hard to give specific advice if you don't show us your code, but typically i might be easiest to use a FOR loop and autoindex over an array of valves and your array of booleans, for example. How are you talking to the valves?
Please attach a simplified version of your code. Thanks.
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • How to display on the graph three or more waveforms where time scale is not an index of array but a real time

    How to display on the graph three or more waveforms where time scale is not an index of array but a real time:
    I measure three voltages Va, Vb, and Vc on my Test stands every 3sec. So I’m building four arrays (Va, Vb, Vc, Time) and combine all in one.
    Time
    Va
    Vb
    Vc
    0
    5
    3.5
    2.8
    3
    4.9
    3.6
    2.9
    6
    4.8
    3.8
    2.1
    Now I need to show on the graph in which scale X is “Voltage” and scale Y is “Time”.
    How can I do it?
    Thanks a lot,
    Boris

    Hi, thanks all your reply.
    You may find "points_to_bar_graph.vi" from this website, I find it by this way.
    I will ask a stupid question: I don't have any photo processing software, how can I save the vi into a picture format?
    So here I just paste it into word document.
    Attachments:
    question.doc ‏520 KB
    points_to_bar_graph.vi ‏62 KB

  • Index an array of images only the last image shows

    Hi everyone,
    I try to index an array of images and all but the last element give me the error: "not an image."
    Here is a picture of the vi. The first for loop loads the images and stores them in an auto indexed tunnel. Every diagnostic I ran on this loop showed everything is fine. The second for loop should display the sequence of image stored in the auto indexed tunnel, but it does not. Instead I have the error message that elements 0 to n-1 are not images, and only the last image is displayed.
    What am I doing wrong?
    Thanks for your help.
    and the vi: 
    Solved!
    Go to Solution.
    Attachments:
    PulsedImageDisp1.vi ‏31 KB

    Speed of what? The second loop can't run until the first loop is done, and all the operations are linear. I'm guessing you're referring to the perceived speed of displaying the images one after the other so you don't have to wait for the next image to be read which is why you pre-load all the images. Otherwise, the overall speed should be the same whether you use one loop or two. Actually, to be technically accurate, the two loop version will likely be a little slower overall since LabVIEW has to allocate more memory to store all the images, while in the one loop version it is only ever dealing with one image. If the images are large then you might actually run into a memory issue with the two-loop version (arrays need contiguous memory). Just something to keep in mind and to be careful about.

  • Show biggest index in array with value "True"

    Hello,
    Is it possible to show the maximum index number with value "true", like shown underneath?
    I can show the value on what index the series of "true" ends with the "Array Max & Min" function, but when there is
    one False between those True's, it will show the index of the True left of the False.
    I don't need to know the size of the array, because it has to stay 8
    File is attached
    Solved!
    Go to Solution.
    Attachments:
    Biggest index of array with value 1.vi ‏8 KB

    Hi Stef,
    here you go:
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • There should be a way to index an array with an array of indexes or booleans (without a loop)

    Hi, often I would love to index an array with an array of indexes or an array of booleans without having to loop it.  I.e: let the IndexArray function accept an array of indexes instead of discrete indexes.  The output should then be an array of indexes values.  
    Another use case is to index with an array of booleans, so each TRUE element would index the input array and FALSE elements are not indexed.
    arrResult = arrInput[ arrIndexes ];  or
    arrResult = arrInput[ arrVal > 20 ];
    Would this be useful? Possibly it could be implemented in future versions?

    You forgot the link.

  • Labview 7 index waveform array by channel name string

    I was messing around with the index array waveform function with a waveform array(3 elements). I had used the set waveform attribute vi with the name input set to "Channel Name." The index waveform array function would not return any data when I was passing a particular channel name to it. Inside the vi I noticed that the name input has to have the format "NI_ChannelName" to match the string constant. Is this explained in the documentation anywhere?? Wouldn't it be more useful to make this string constant a string control input that we wired data into?? Then we could index the waveform array based on any name input that we set with the waveform attribute function.

    Hi 08,
    despite reanimating an 11 year old thread that information you requested is given in the "Set Waveform Attribute Function" help as written by Brandon…
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How to Use a Boolean Vector To Index an Array

    Say I have an array A = [1 2 3 4 5 6 7 8 9 10].
    I also have a boolean array B = [1 1 0 0 0 0 0 0 0 1].
    I want to use the boolean array B to pick out elements in A, creating a new array C = [1 2 10]. In MATLAB, I would just type C = A(B).
    I'm scratching my head trying to figure out how to do this. One solution would be to run through a for loop, querying B(i), and deleting A(i) if B(i) = 1. But this would change the size of A, so that the second time I did this, my index would be wrong.
    Anyone know a clean way of doing this?
    BONUS: If I have a 2D AA, with multiple columns, it would be nice to use B to pick out multiple columns of AA (in MATLAB, this would be CC = AA(:,B).
    Solved!
    Go to Solution.

    This can be done with auto-indexing with conditional tunnels.  The same approach could easily be applied to a 2D array, as well:

  • Iteration Speed issue when Indexing 3D array wried to a while-loop

    Brief Description of my Program:
    I am working on the real-time signal generation by using LabView and DAQmx (PCI-6110 card). My vi reads the big data file (typically 8MB txt file containing about 400,000 samples (complex double precision). Then, the signal is pre-processed and I end up with a huge 3D array to feed while-loop (typically 3D array dimension is N x 7 x M where N & M >> 7). Inside the loop, that 3D array is indexed and processed before the results are written to the DAQmx outputs. I have a speed issue when indexing the large 3D array (i.e, 3D array having a large sub-array size). My while-loop could not run fast enough to top-up the DAQmx AO buffer (at the output rate of 96kHz). It could run faster only if I use smaller 3D array (i.e, smaller-sized sub-arrays). I do not quite understand why the size of 3D sub-array affects the rate of looping although I am indexing same sub-array size at each iteration. I really appreciate your comments, advices and helps.
    I include my 3D array format as a picture below.
    Question on LabView:
    How does indexing an 3D array which wires to the while-loop affect the speed of the loop iteration? I found that large dimension of sub-arrays in the 3D array slows down the iteration speed by comparing to indexing the same size of sub-array from smaller-sized sub-arrays of the 3D array to perform signal processing inside the while-loop. Why? Is there any other way of designing LabView Program to improve speed of iteration?
    attachment:

    Thank you all for your prompt replies and your interests. I am sorry about my attachment. But, I have now attached a jpg format image file as you suggested.
    I had read the few papers on large data handling such as "LabVIEW Performance and Memory Management". Thus, I had already tried to avoid making unnecessary copies of data and growing arrays in my while-loop. I am not an expert on LabView, so I am not sure if the issues I have are just LabView fundamental limitations or there are any other ways to improve the iteration speed without reducing the input file size and DAQ output rate.
    As you request, I also attach my top-level vi showing essential sections such as while-loop and its indexing. The attached file is as an image jpg format because the actual vi including Sub-VIs are as big as 3MB in total. I hope my attachment would be useful for anyone who would like to reply my question. If anyone would like to see my whole vi & llb files, I would be interesting to send it to you by an e-mail privately and thus please provide your e-mail address.
    The dimension of my 3D array is N x 7 x M (Page x Row x Column), where N represents number of pages in 3D array, and M represents the size of 1D array.  The file I am currently using forms 3D array of N = 28, & M = 10,731.  Refering to the top-level vi picture I attached, my while-loop indexes each page per iteration and wrap-around.  The sub-VI called "channel" inside the while-loop will further index its input (2D array) into seven of 1D arrays for other signal processsing.  The output from that "channel" sub-VI is the superposition of those seven arrays.  I hope my explaination is clear. 
    Attachement: 3Darray.jpg and MyVi.jpg
    Kind Regards,
    Shein
    Attachments:
    3Darray.jpg ‏30 KB
    MyVI.jpg ‏87 KB

  • Error when indexing an array

    HI
    i uses the LV string to unicode string.vi to convert a string to a numeric array. After this is done i want to index this num. array to get the first two elements, but only the first element will be displayed, not the second!!, the seconde is always "0".
    for a better understand please have a look at my screenshot
    LV PDA 8.2
    Win PocketPC 2003
    sincerely
    timo
    Attachments:
    Array_LV_PDA_82.JPG ‏126 KB

    Hi Timo,
    I didn't find the "string to unicode.vi" on my system, but I know, that unicode stores every character in 16bits. I suppose, if you index the next element in the array, you would get the expected 50. I think it would be more convenient to output an U16- Array in the "string to unicode.vi".
    The intention of unicode was to put several character- codepages into one single chartype.
    Greets, Dave
    Greets, Dave

  • Using a For Loop Index for Array Element Number?

    Hi.  Thanks in advance for the help.  I can't seem to find what I want to do here using the search function... probably because I don't know how to frame the question appropriately.  Ignore the title to this post cause it's probably wrong vocabulary for what I want to do.
    Here's the situation:
    I have a 2D array where the first column is the X data and each subsequent column is Y data (call it Y1...Yn).  The n-value varies from run to run (some runs have 4 columns of data, some have 20), but that is easily gathered when reading the data file.  I need to perform a number of operations on each set of data, the least of which is smoothing the data and graphing it, so I'm limiting my discussion to these 2 operations.
    What I want is a for loop structure where the indexing of the loop tracks the Y1...Yn columns, grabs each column for the iteration, performs the relevant analysis, and spits out the result, but in a stackable manner.  Thus the title; I want to use the for loop's index to mark the array element for building a new array.
    See the image attached.  A 2D array of 9 columns (X, Y1...Y8) is analyzed such that each data set, (X, Y1), (X, Y2)...(X, Y8) is bundled, graphed, run through a B-spline Fit, of which is also graphed.  I need to replace this with something that looks like the for loop structure shown.  
    I just don't know how to get those two data bundles [(X, Yi) and it's smoothed pair] out of the for loop in a stacked set from every iteration of the for loop.
    Again the title, I think I want to build a new array where i use the index of the for loop to control the entries of the new array.  But I can't see how to do that.
    Any help would be appreciated.
    Attachments:
    NeedForLoopForThis.PNG ‏30 KB

    Hello H.R. Dunham, and welcome to the forum!
    It seems that you may be looking for Auto-Indexing, a basic feature of loops in LabVIEW.  You'll need to transpose your array before wiring it into the for loop, as elements are auto-indexed by row before column, but at that point you should be able to operate on each column and output an array of n cluster elements corresponding to your input columns.  Auto-indexing tunnels look like brackets to indicate each element will be indexed automatically- this should be the default when wiring an array into a for loop or when wiring anything out of a for loop.
    As for how to build your pairs, I suggest removing the X column and creating a "starter" cluster containing your X data and placeholder Y data before entering your "Y" processing loop.  Use the bundle by name function in the for loop to insert your processed column data into the cluster and auto-index the cluster output. Flow would be something like this:
    1) Gather data
    2) Split X and Y using standard array operations
    3) Create "template" cluster with shared X data
    4) Pass template cluster and Y-column array into an auto-indexed for loop.
    5) Insert processed Y data into cluster inside loop.
    6) Auto-index cluster data out of loop.
    This tutorial is probably also a good place to get started:
    Getting Started with NI LabVIEW Module 3: Loops
    http://www.ni.com/white-paper/7528/en/
    Hope that helps!
    Regards,
    Tom L.

  • Why are date and time strings lost when indexing an array in a for loop

    Hi, 
    I have an application where i'm reformatting data from a spreadsheet for graphical display on a LabVIEW dashboard.
    the original spreadsheet has date and time values in separate columns, and i'm merging them and converting to a timestamp value.  But something's not working.  Does anyone know why the string value is lost when the array indexes into this for loop?
    Attachments:
    failed array index.png ‏142 KB

    Can you attach your VI with some typical values? (e.g. create in indicator on the 2D array, run your VI, then turn the indicator (now containing data) into a diagram constant). Place the FOR loop related code and that diagram constant into a new VI and attach it here.
    How many times does the FOR loop run? Could it be that the last element of each 1D array is an empty string? (unless you put a wait inside the FOR loop, you'll never see the other elements in the probe)
    LabVIEW Champion . Do more with less code and in less time .

  • Determine index of array within event structure

    I am doing some testing with dynamically registered events.  For these testing purposes, I have 2 separate arrays of boolean references hooked up to the dynamic input terminal.  The event structure is executing like I expect it to.  The only problem is that I want to know the index within the array for the event that triggered the value change event.  I would have thought I could use the CtlRef node to determine this, but instead it returns a reference to the actual boolean control that triggered the event.
    I could write a subroutine that searches for the label of the boolean that triggered the event within the arrays, but that is not efficient or good practice.
    So for instance, if I click on Boolean 2, I'd want the event structure to know it was array #1, index 1.  If I click on Boolean 6, I'd want the event structure to know it was array #2, index 2.
    Is this possible?

    That is a very good idea.  The caption is good to use for the label you show to the user.  You can change it to show different things, even programmatically, such as if you need to make your application more international and have it display controls in different languages to different users.  It lets you use longer or more descriptive names, without having those long names eat up block diagram space.
    Another thing I've done is take the control reference and search for it among the array of control ireference.  Search 1-D array will give you the index of the control within the array.  Then I can use that index and apply it to a different array and index out a value from that.  It could be a name, or perhaps a numeric value I use as a multiplier or something like that.  Just make sure there is a one to one correlation between the references in the array and whatever is the other array you are getting additional data from.  For what you have drawn now, it could be a little bit complicated because you actually have two different 1-D arrays of references.  But if you concatenated those arrays together, you'd have a single 1-D array you can search.

  • Drag and drop de index de array

    se puede usar drag and drop en el idex de un array?
    necesito arrastar el valor del index de un array y depositarlo en una celda de una tabla, e intentado con los ejemplos de drag and drop pero no me a funcionado y no se si se p ueda hacer esto en labview 2011.
    si alguien tiene experiencia en estoy y me ayude.
    gracias

    solucionado.
    tuve que identificar el index en la celda del array en que se dio clic y combinarlo con drag and drop

  • Boolean index of array

    In Matlab often use a boolean array to access specific values in an array.
    This is a good way to reduce itterative loops and improve code speed.
    I am trying to find a way to do this in a Mathscript node as otherwise the code takes ages to run.
    Common code in Matlab and Mathscript: 
    a=[1,2,3,4,5]; %normally this is a much larger array
    b=[1,0,1,0,1]; %I want this to be boolean, but by default it is double
    c=b>0;  %change b into boolean
    d=[9,9,9,9,9]; 
    The Matlab code is:
    d(c)=a(c);
    d
    >>d=[1 9 3 9 5]
    If I run the above in Mathscript I get the following error:
    In Mathscript, to get the same "d" result I currently do:
    for i=1:length(d) 
       if c(i)==1
          d(i)=a(i);
       end
    end
    d
    >>d=[1 9 3 9 5]
    A slightly faster version is:
    for i=1:length(d)
       j=1;
       if c(i)==1
         e(j)=c(i);
          j=j+1;
       end
    end
    d(e)=a(e);
    d
    >>d=[1 9 3 9 5]
    Any ideas?
    Thanks
    Solved!
    Go to Solution.

    Hello,
    The code you posted works fine in the MathScript node in LabVIEW 2009 as well as in the MathScript Window and the MathScript node in LabVIEW 8.6.  As such, I will assume you are getting an error in the MathScript Window in LabVIEW 2009.  We have already identified this issue and currently have filed bug report 151999 for it.  The error message you are seeing did not come through in your post, so I assume it is -90026: "The indexes for a matrix indexing operation must be real, positive integers."  The problem is that we are not treating the "c" indexing variable as a boolean.  As such, this reports an error when it tries to use index 0 instead of a false.  We are working on a fix for a future release.
    As a workaround in the MathScript Window, you can use the find command in lieu of any boolean indexing.  It should operate quicker than the loop implementation you reference.  Instead of
    d(c) = a(c);
    use
    d(find(c)) = a(find(c));
    Grant M.
    Staff Software Engineer | LabVIEW MathScript | National Instruments

  • Make index square array

    I am writting a method that should create an array of 10 integers, where each element holds the square of its index number (thus, for example, myArray[3] should hold the value 9). Here is my code that does not work properly.
    public int[] makeIndexSqArray(){
    int[] myArray = new int[10];
    for (int i = 0; i < myArray.length; i++)
    myArray[i] = myArray[i] * myArray;
    return myArray;
    Any suggestions?
    Thank you ,
    Peter

    Before this line:
    myArray[i] = myArray[i] * myArray;
    include this
    myArray[i] = i;

Maybe you are looking for

  • AIR Runtime 2.5.1 - Camera bug

    With AIR runtime 2.5.1, no cameras are found on Mac and Windows. (Application built with Flex SDK 4.1 and AIR SDK 2.5) This is a very very severe bug. Is there any workaround? How many hours until Adobe will release an emergency fix 2.5.2? Is there a

  • Noise in background

    NOISE.  Sometimes it makes background noise, as if it is updating something or running a scan but yet it is not running a scan and i see no evidence of an update taking place... it will go on for hours... i sometimes have to restart the computer.  Do

  • How to specify for JVM the stack for ONE specific thread that invokes JNI

    Hello all! I'm 2 days now looking for a solution in several forums but even in Sun Java Forums nobody was able to come up with a solution. If you know a better forum to place it, please let me know. Description: I have an application that launches se

  • Image quality CFPDF

    Hello, I'm creating a PDF with CFDOCUMENT and CFPDF and I have two questions 1. I'm trying to insert an image with the following code: <cfdocument name="cover" format="pdf"> <img src=" http://www.domain.com/image.jpg"> </cfdocument> <cfPDF action="wr

  • NTFS and Guest account

    Using NTFS on Win2000 iFS1.1. If the user does not have an account, they get the default guest user. I see in Setup and Admin guide that SMB def has a parameter of AllowGuestIfNotUser. I see no such parameter in the NTFS sever def file. Is there anot