Indexing data on a for loop to overlay data on a xy graph

I am using express VI's to measure both voltage and current data in a For Loop. I want to plot a current vs voltage graph but have each iteration of the loop overlay the others as if it were its own independent data set. I have been unable to bundle the data and convert it into a xy graph because of the number of elements, 3 for the bundle and 2 for the graph. I need a method to index the dynamic data wires so that I can overlay them.

Hello,
After reading the thread, it sounds like you're looking for a chart-like graph - I have attached an example with illustrates this.  Keep in mind that "graphs" in LabVIEW generally plot arrays of data (in the case of an XY graph, you pass a cluster which contains an X and Y array).  The example behaves like a chart by building an array one data point at a time (in this case both an X and Y array of course) on each iteration of a loop, and displaying the data at each loop iteration - this gives the look and feel of a chart which accumulates data.  It is attached in version 7.1 - hopefully you have that version or later to open it.  I have also attached a program which shows how to plot multiple data sets on an XY graph, in all 3 current formats accepted by the XY graph - it's attached in version 8.0 because the ability to plot complex data to an XY graph was added to version 8.0, and it illustrates this as well.
Best Regards,
JLS
Best,
JLS
Sixclear
Attachments:
XY Chart-like Example.vi ‏24 KB
XYGraphWithArbitrarilyManyPlots.vi ‏32 KB

Similar Messages

  • 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

  • For loop indexing?

    Is it possible to change indexing step in labView "For Loop" structure? By
    default this value is 1, and I need to make a step value different from "1"
    like in C example:
    for (index=0; index < 100; index++) {}; // step=1
    for (index=0; index < 100; index=index+3) {}; // step=3
    Sergey Yakovlev, Berlin,
    [email protected]

    Hallo, Sergey,
    Du (yakovlev) meintest am 21.09.01 zum Thema for loop indexing?:
    > Is it possible to change indexing step in labView "For Loop"
    > structure? By default this value is 1, and I need to make a step
    > value different from "1" like in C example:
    > for (index=0; index < 100; index++) {}; // step=1
    > for (index=0; index < 100; index=index+3) {}; // step=3
    What about
    j:=i*3
    and i is incremented by 1
    Greetings!
    Helmut
    Please excuse my gerlish!

  • I have a for loop inside of while loop.when i press stop for while loop, i also would like to stop for loop.how can i solve this problem?thanks

    i have a for loop inside of while loop.when i press stop for while loop, i also would like to stop for loop.how can i solve this problem?thanks

    Hi fais,
    Following through with what JB suggested. The steps involved in replacing the inner for loop with a while loop are outlined below.
    You can replace the inner for loop with a while by doing the following.
    1) Right-click of the for loop and select "Repalce" then navigate to the "while loop".
    2) Make sure the tunnels you where indexing on with the for loop are still indexing.
    3) Drop an "array size" node on your diagram. Wire the array that determines the number of iterations your for loop executes into this "array size".
    4) Wire the output of the array size into the new while loop.
    5) Set the condition terminal to "stop if true".
    6)Drop an "OR" gate inside the while loop and wire its output to the while loops condition terminal.
    7) C
    reate a local of the boolean "stop" button, and wire it into one of the inputs of your OR gate. This will allow you to stop the inner loop.
    8) Drop a "less than" node inside the inner while loop.
    9) Wire your iteration count into the bottom input of the "less than".
    10) Wire the count (see step 4 above) into the top input of the less than. This will stop the inner loop when ever the inner loop has processed the last element of your array.
    Provided I have not mixed up my tops and bottoms this should accomplish the replacement.
    I will let others explain how to takle this task using the "case solution".
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How to pick up indices for a for loop

    hi guys , 
    i have a for loop with N = 60 , i'm trying to make something when the index (i) reachs specific number , the indecies i'm interested in are
    1 ,5 , 9,13, 17, 22, 26, ,30,34,38,43,47,51,55,59
    the difference is 4 in some of them but it changes to 5 @ 22 and 43 and come back to 4 in between .
    can anybody help me pick up these indecies ?

    Hi bmemq,
    You can do this with the Equal? function found in the Comparison palette. You would have one Equal? function for each index that you're interested in- one input would be a constant of that number and the other input will be the index terminal of the for loop. Next, you can you a Compound Arithmetic found in the Boolean palette. The number of inputs of the Compound Arithmetic can be expanded to match the number of indices that you're interested in, and each input will be the output of an Equal? function. Finally, the output of this Compound Arithmetic will be in the input of the selector in a Case Structure where you will have a true and false case to toggle the Boolean. 
    Josh Y.
    Applications Engineer
    National Instruments

  • Arrays dimension changed by "for loop"

    When using a two(multi)-dimension array as input to a "for loop", the connection
    changes inside the loop to a 1D array automatically. Why?!?
    I want to perform the same procedure on each subarray of the basic two-dimension
    array, by specifing an index. The second dimension I disable indexing. The
    index itself can be the for loop index. The problem is the change in connection
    between out and in of the for loop.

    The question is that you have indexing enabled in the for
    loop entry, and the for loop will convert your 2D array in
    the necessary number of 1D arrays to be completed in the
    for loop. This is good when you don't know how long the
    array is going to be, but if you don't like it, you can
    right click on the input tunnel and disable indexing.
    Hope this helps.
    * Sent from AltaVista http://www.altavista.com Where you can also find related Web Pages, Images, Audios, Videos, News, and Shopping. Smart is Beautiful

  • 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 .

  • Config data refnums invalidate​d by for loop

    I have found the following problem with LabVIEW 7.0. This only occurs when running the application as built with the application builder and does not appear to be a problem in the development environment.
    Given an open refnum for a config file one can loop through several read key operations while passing the data and the refnum to outputs on the for loop. If you disable indexing on the refnum output of the for loop you should get a usable refnum out. What happens instead when you try to close the refnum is an error indicating that the refnum is invalid. If you simply route the refnum around the loop avoiding the for loop output altogether this doesn't happen. It appears that somehow, going through the indexing output of the f
    or loop invalidates or changes the refnum when in a built application using the runtime.
    If anyone can reproduce this or prove me wrong it would be helpful. This bug cost me days of chasing down why my "major app" would only work when in development but fail when built. The lack of debug capability in a built app of course leant to the effort that it took to track this down.
    Thanks,

    Hello, i'm french so scuse for my writting...
    I don't find where put this question so i writte here.
    I want to do a soft who's objective is to writte config data (open config data + write key + close..).
    you can find it in the join piece.
    this soft run correctly but when i do an exe with the application builder, when i try to run the exe, that saying me error 7 about the Nex file in Open config data...
    How can i solve this problem???
    Tanks for all....
    Attachments:
    chconfexe.vi ‏32 KB

  • Read data from text file one by one using for loop

    Dear Forum
    I want to read data of single colum of text file inside the for loop one by one(for each iteration value must be replaced by another value of text file).This value is used by a formula inside for loop. also after completion of iterations the values must be plotted on xy graph. How to do it.? please help me.
    profravi

    It's not very efficient to read a file line by line. Much simpler to read it all at once and then auto-index the results inside a for loop. The image below shows a generic solution to your problem. This assumes that the data in the file is in a single column.
    I would also recomend checking ou the learning LabVIEW resources here.
    I would aslos suggest that since this type of question is not specific to either NI-Elvis or the LabVIEW SE, you should post similar questions to the LabVIEW board. If you have problems, attaching a sample of the text file would help.
    Message Edited by Dennis Knutson on 10-18-2007 09:11 AM
    Attachments:
    XY Graph From File.PNG ‏4 KB

  • 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.

  • I'm having problems manipulating array data within a for loop, and extracting the required sub-arrays generated.

    Hi,
    I'm using labVIEW V5.1
    I'm trying to generate 10 1D arrays, the first array is initialized to all zeroes, then I have set up a for loop which shifts the first element by 1, then a random number is placed into the first element position. I am using a shift register to feed back in the newly generated array into the start of the loop.
    By the end of the each loop I want to be able to use the array generated in an algorithm outside the loop. However I only want the Nx1 array that has just been generated.
    Unfortunately, I cannot figure out how to resize, reshape or index the output array to do this.
    I would like the loop to
    give me out a 1D array after each iteration.
    Any help would be greatly appreciated.

    I hope I've understood your problem.
    First your vi was lacking of the sub-vi working as shift register, I've replaced it with the rotate function.
    The indexing of your arrays create a 2D array whose rows are your 1D array.To pick only one of them you have to use the index array function and select which one you want.
    To use your temporary data in another part of your application you should use a local variable of array2.
    I did it in a separated while loop That I syncronized with the for loop using occurrence, in this way the while loop runs each time a new value is inserted in array2 (each loop of the for loop structure).
    If you don't need this syncronization just get rid of occurrence functions.
    I place a delay in the for loop to show what happens when running.
    Hope it was helpful.
    Alberto Locatelli
    Attachments:
    array_test_v3.vi ‏35 KB

  • Writing data to spreadsheet in FOR loop without shift register

    My program has a case window within a For loop.  The loop iteration index is wired to the case, so there’s a case for each iteration of the loop (about 30 cases).  In each case, data points are gathered, formatted to a spreadsheet and written to a file, along with some occasional header strings to describe the data.  This works fine, as I can simply write the data to file as soon as I get it. 
    At some point in the loop, I’m gathering from two sources (rpm data for two fans) over several iterations that is to be written to two separate but similar formatted tables in the same output file.  Since I’m writing two tables to one file simultaneously, I can no longer write on-the-fly in a linear fashion; I’d need to store all the information until I complete the iterations, then format the header & raw data to spreadsheet and write to file in two chunks – at least, this is what I believe is the way to go, but I’m all ears if there’s another way.
    In order to buffer the data, I could use a shift register, but this requires me to wire an array across my loop for all loops, whether I’ll be using it or not.  I’ve also considered initializing an array at the case I’ll need to start buffering, then writing to a local variable of that array, but in fiddling with this approach, I don’t see how to specify what index to which I’m storing the data point.
    So I’m looking for advice on whether (1) there’s another way to accomplish my goal and/or (2) how to execute the initialize array and local variable approach. 
    Below is a picture of what I want this portion of the spreadsheet to look like.  Also included is a much abbreviated mock-up of my program for a case where I’m writing on the fly for a single table or column of information and a case where I’m setting up the write to local variable approach.  
    Message Edited by TESTIE on 04-03-2008 12:48 PM
    Attachments:
    illustration22.JPG ‏52 KB
    output_file2.JPG ‏120 KB
    illustration3.JPG ‏50 KB

    An Action Engine can thought of as an encapsulated shift register.
    AE's out-perform locals while alos elliminating possible race conditions. You may want to review the Nugget I wrote on Action Engines.
    Just trying to help,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • I'm doing a scan around a line by sampling data 360 degrees for every value of z(z is the position on the line). So, that mean I have a double for-loop where I collect the data. The problem comes when I try to plot the data. How should I do?

    I'm doing a scan around a line by sampling data 360 degrees for every value of z(z is the position on the line). So, that mean I have a double for-loop where I collect the data. The problem comes when I try to plot the data. How should I do?

    Jonas,
    I think what you want is a 3D plot of a cylinder. I have attached an example using a parametric 3D plot.
    You will probably want to duplicate the points for the first theta value to close the cylinder. I'm not sure what properties of the graph can be manipulated to make it easier to see.
    Bruce
    Bruce Ammons
    Ammons Engineering
    Attachments:
    Cylinder_Plot_3D.vi ‏76 KB

  • Storing a lot of data in an indexed data structure for quick access.

    I'm designing an app. which will need to store a large amount of data in memory. Records will be flowing into the app. via a socket. The app will receive about 30 records/second which is about 108,000 records/hour and about 600,000 records/day. I need to store the records in an indexed data structure so that I can access them quickly. For example, at 9:00am I will need to access records received at 8:30am, 8:35am, 8:40am, etc. This program will be multithreaded and as I understand Vector is the only data structure that is thread safe. Is Vector my only choice? How do I access objects in a Vector using an index? Is there something better that I can use?

    Is Vector my only choice?If you want to access the objects by key then you should use something like a HashMap. But if you want to access them by an array index then an ArrayList would be more appropriate.
    as I understand Vector is the only data structure that is thread safeYou can get a thread-safe version of any Collection object by using the Collection.synchronizedCollection method.
    How do I access objects in a Vector using an index? I'd suggest you read the API documentation. And probably the Sun tutorial on Collections at http://java.sun.com/docs/books/tutorial/collections/index.html
    600,000 records/day. Unless you plan to dump old data after a short period of time, you may want to consider using a database to avoid running out of memory.

  • How to output data outtside a for loop every 10 iterations​?

    Hi friends,
    does any body help me to sort out this problem?
    please check the attchement for my vi.
    all i want is output data from inside for loop to outside for loop every 10 iterations. please do not use local variable.
    Many thanks
    dan
    Attachments:
    output.vi ‏16 KB

    Hi Dan,
    I am not sure what you want to do every 10 iterations with the value outside, but If you want to update your graph every 10 iterations use the following way:
    If you want to handle the specific value every x iterations outside the loop you could either use queues or notifieres.
    BR,
    ThSa
    Message Edited by ThSa on 08-23-2006 09:05 PM
    http://www.newgistics.com
    Attachments:
    1.png ‏6 KB

Maybe you are looking for