Plot XY graph from while loop

I am trying to make a curve tracer with a DC power supply, DAQ, and Labview 7.1. Everything is ok, until I want to plot an x-y plot from a while loop. I can do this function fine using a for loop and cluster cells, but I need the while loop for the interruption function. When I change to the while loop, it had data formating issues, but I believe I have it to something that should work. It seems like my xy plots want to graph (the auto scale moves the axis respectively) but I do not get a line. I'm not sure if Labview is seing this as just one point and not an array, or if there is a labview bug. Attached is my code with a few different trials to make an xy plot. If anyone can be of help I would be very thankful.
-Jon
Attachments:
Curve_trace_w_relays_while.vi ‏122 KB

If it works in a FOR loop, but nor in a while loop, most likely your output tunnels are not autoindexing (FOR: on by default, WHILE: off by default). Right-click on the output tunnels and select "enable indexing".
If you want to watch your graph update during the while loop, you could accumulate your x and y data in a shift register and graph it. (See attached modification).
LabVIEW Champion . Do more with less code and in less time .
Attachments:
Curve_trace_w_relays_whileMOD.vi ‏74 KB

Similar Messages

  • How to Send Multiple Plot XY Graph from LabVIEW to Microsoft Excel

    The link below describes exactly what I would like to do, however the link to the solution/work around does not work.
    Has anyone got an alternative solution?
    http://digital.ni.com/public.nsf/allkb/CFD30D5E9C01AB5386256CFB0082AF3E

    Please check the link again as it seems to be working fine now.
    How to Send Multiple Plot XY Graphs from LabVIEW to Microsoft Excel:
    http://digital.ni.com/public.nsf/allkb/CFD30D5E9C01AB5386256CFB0082AF3E
    The standard Excel Insert Graph.vi cannot insert multiple XY Graphs to Microsoft Excel, so you will need to use the Report Generation Toolkit for Microsoft Office.  You will find a link to an example program at the bottom of the page.  I have also attached it below.
    Attachments:
    example.zip ‏35 KB

  • Real time waveform graph in while loop

    Hi
    I have a VI which includes a subVI that reads data from an oscilloscope and presents the output in the form of a cluster made up of the initial time t(0), a time interval delta t and an array of voltage readings.
    This cluster can then be wired to a waveform graph in the usual way. All of this is situated within a while loop in my VI and on each iteration of the loop I obtain a waveform graph of the voltage readings starting at the same time t(0) and ending at the same time t. However I want my graph to begin at a time t(0) when I set my VI running and then continuously acquire and build up the data on each iteration of the while loop so after my VI has finished executing I have a complete graph of all the voltage readings acquired after the set number of iterations of the loop. I know on the Express X-Y Graph VI you can double-click the node and deselect the box that says 'clear data on each call' - if I could do this in my case that would be great but I can't use an x-y graph because I have an array of y-values to plot on each iteration.
    If anyone can help me out it would be much appreciated - I'm sure there must be an easy solution to this but I'm going out of my mind trying to find out what it is!
    Many thanks,
    Bex.

    As usual, you have several options.
    You can use an XY Graph by generating the X values yourself. This will ensure that you place the data exactly where you want it on the X axis. This is fast, but does involve a memory cost.
    You can use a Waveform Graph with a waveform input instead of the cluster you are using. Use the Build Waveform primitive instead of the bundler to make your waveform. Set the t0 values to the appropriate values (negatives do work, as do small numbers - time is in seconds, use the To Time Stamp primitive to convert from DBL to timestamp). Finally, you need to set the Waveform Graph to use the t0 values. Pop up on the Waveform Graph and make sure Ignore Time Stamp is not checked. Depending on your version of LabVIEW, you may have to pop up on the graph or the axis. When you unselect Ignore Time Stamp, you will probably want to reformat the X-axis again. The Waveform Graph clears data at each iteration, so you will need to replot all your data each time. Just create an array of waveforms and keep adding to it. The t0s will put the waveforms in the right places. Yes, this may cause memory problems.
    Finally, you can use the Waveform Chart, which does have memory. Create the waveforms like you did for the Waveform Graph and send them to the chart. It will remember what was sent to it from run to run. Make sure you set the Chart History Length (pop up on chart and select Chart History Length...) to long enough to hold your entire data. You can use a property node to get the data back at the end, if you need to.
    Good luck!
    This account is no longer active. Contact ShadesOfGray for current posts and information.

  • Keeping data on graph once while loop exits

    Hi, I have the attached vi where I am reading in Bluetooth data, plotting and saving the data. My inner while loop is the one performing the plotting, where I have the error out of the Bluetooth Read function wired to the boolean control of the loop. If for some reason the connection gets distrupted, the loop exits and the BT automatically reconnects.  The problem here is that one the inner loop stops, the graph plotting the data clears.  I am looking for a way to keep the data plotted on the graph, so once the connection is lost and reconneted again, the data continues plotting from where the connection was lost.  I cannot figure out how to do this, I tried to use local variables to plot the data outside the graph while the loop is running but that didn't work. Can somene provide me assistance?
    Attachments:
    test.vi ‏55 KB

    moderator1983 wrote:
    My bad...!!
    I was working late night and misinterpretate "Write to File" express VI with "Build XY Graph" express VI..!!
    Anyways the attached code should work fine.
    Here, I took care of some of your Rube Goldbergs.
    I'll try to get something written up to show a Queued Message Handler...
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    I love clean code more.vi ‏53 KB

  • How should I set up my VI so that I can use the linear fit coefficient data analysis program, when my values are coming from while loops within a sequence structure?

    I'm attempting to create a calibration program, using the printer port, and a Vernier Serial Box by modifying a calibration program designed for the serial box.
    There are six calibration points, and to collect them, I have it controlled by while loops so that the numbers are taken when a button is pushed, and this is inside a sequence structure so that I can get the six different points. I feed these numbers into two different arrays (for x and y values) and then try to use the linear coefficient analysis on these points, but the values for the slope and intercepts it returns are not correc
    t.
    If I cut out the array and coefficient analysis, and feed the same numbers in directly without the while loop and sequence structures, it produces the proper values... I don't know why the numbers it is producing are different, and I'd really like to know.
    Thanks,
    Karinne.

    I would use a data manager sub-vi that would be called by each from of the sequence structure that produced a data point. The data manager sub-vi could auto append new items or could place items in a specific entry of an array. Later on when you want to calculate the linear fit, call the sub-vi to return the array of values.
    Stu

  • Graph from For Loop

    hello,
    I have a problem with one of my applications I am developing.
    I calculate a timeSeries and I need to graph it on linechart. The timeSeries is calculated through an iteration of For Loop
    I have tried to write in an array, but it didn't work since I can only take one value.
    I tried to write the value in a datagrid but that didn't work either!
    not because it is impossible, but because I am an idiot
    http://alimsyed.com

    Hi Dimitris,
    Thanks for the post and I hope your well today.
    You can achieve this by using a reference of the graph from the main VI, pass it to the subVI vi and use a property node to update the graphs value. 
    I have attached an edit of your code to show this, labVIEW 8.6. 
    Kind Regards
    James Hillman
    Applications Engineer 2008 to 2009 National Instruments UK & Ireland
    Loughborough University UK - 2006 to 2011
    Remember Kudos those who help!
    Attachments:
    mainVI.vi ‏9 KB
    subVI.vi ‏13 KB

  • How to plot XY graph from 2 input of dynamic array ? ...

    I have 2 problem when I plot XY graph with 2 dynamic array :
    - I want to make the graph look like sweep chart. But it's seem not possible to use waveform graph?
    - The graph shoul move from left to right , then right to left, then left to right,.....
    Any one can give me some hints?  Thanks alot.
    Attachments:
    U1.PNG ‏21 KB
    XY radom value input.vi ‏147 KB

    I have to make Y change  from 0-10, then 10-0,.... Any one can help me to make it better?
    - How I shift the graph?
    Attachments:
    working_increse_decrease.vi ‏20 KB

  • Php recordset outputting last value from while loop

    Hi all,
    I have an issue with a site I am making which lists radio buttons which are a set of donation options (some with predefined prices some with user dependant).
    I used jQuery to populate a textbox with the value of the radio buttons so the person does not need to enter a price they want to donate.
    The issue I am having is that I want the page to carry across the fund_id (which is the primary key) to the next page.
    Currently the do / while loop goes through all of the recordset and passes across the last record's fund_id.
    Please see my code below:
    $(function () {
    $('input.radioButton').click(function () {
    var checkedradio = $('[name="fund"]:radio:checked').val();
      $('#totalPrice').val(checkedradio);
    And
    <h3>General</h3>
    <?php do { ?>
      <label><input class="radioButton" type="radio" name="fund" value="<?php echo $row_cat_general['fund_price']; ?>" id="<?php echo $row_cat_general['fund_name']; ?>" /><?php echo $row_cat_general['fund_name']; ?> <?php if ($row_cat_general['fund_price']!="") { ?>- &pound;<?php echo $row_cat_general['fund_price']; ?><?php } else {?> <?php };?></label>
      <br />
      <?php } while ($row_cat_general = mysql_fetch_assoc($cat_general)); ?>
    <h3>Sponsorship</h3>
    <?php do { ?>
      <label><input class="radioButton" type="radio" name="fund" value="<?php echo $row_cat_sponsorship['fund_price']; ?>" /><?php echo $row_cat_sponsorship['fund_name']; ?> <?php if ($row_cat_sponsorship['fund_price']!="") { ?>- &pound;<?php echo $row_cat_sponsorship['fund_price']; ?><?php } else {?> <?php };?></label>
      <br />
      <?php } while ($row_cat_sponsorship = mysql_fetch_assoc($cat_sponsorship)); ?>
    <h3>Seasonal</h3>
    <?php do { ?>
      <label><input class="radioButton" type="radio" name="fund" value="<?php echo $row_cat_seasonal['fund_price']; ?>" /><?php echo $row_cat_seasonal['fund_name']; ?> <?php if ($row_cat_seasonal['fund_price']!="") { ?>- &pound;<?php echo $row_cat_seasonal['fund_price']; ?><?php } else {?> <?php };?></label>
      <br />
      <?php } while ($row_cat_seasonal = mysql_fetch_assoc($cat_seasonal)); ?> 
    <br />
    <span id="sprytextfield1">
    <label>Enter Amount:
    <input name="total" type="text" id="totalPrice" />
    </label>
    <span class="textfieldRequiredMsg">A donation amount is required.</span></span><br />
    <input name="fund_id" type="hidden" value="<?php echo $row_cat_general['fund_id']; ?>" id="fund_id" />
    <input name="button" type="submit" value="Select" />      
    I hope this doesnt look weird, once I have post this.
    Is there a way I can populate "totalPrice" input box AND have "fund_id" hidden field populated with the fund_id of the selected radio button?
    Thanks for your help.

    Hi,
    I have tried this:
    $(function () {
    $('input.radioButton').click(function () {
    var checkedradio = $('[name="fund"]:radio:checked').val();
      var fundidbox = $('[name="fund_id"]').val();
      $('#totalPrice').val(checkedradio);
      $('#fund_id').val(fundidbox);
      alert($("#fund_id").val());

  • Hw can we plot a graph from the data given in a flat file

    i need a program that reads a file with 2 columns:
    - time in minutes for the x axis
    - value (e.g. temperature, heart freq.) for the y axis
    Plot the last m minutes, the y axis shall have a range from min...max.
    Start with parameter values m=5, speed s=1, min=20, max=120.
    After m=5 minutes, the graphical display shall plot the curve of the
    last 5 minutes. In other words, you have to implement a sliding window
    with a 5 minute history
    The speed s is useful for testing, 1=real time, 10=10 times faster.
    To implement the real time behaviour, you have to let the program wait the
    time interval between two values. The time interval is not constant.
    A sample file looks like this (lines 1..3 are always comments):
    -------8<-------cut-here-------8<-------
    Logfile of program temperature_monitor.cpp
    Temp sensor #42, range 30..60 degrees Celsius
    2007-06-21 20:30
    0.017737 45.2
    0.045122 42.7
    0.073591 43.1
    -------8<-------cut-here-------8<-------
    You can download the test data file here:
    http://alf42.dyndns.org/oost/temp_testdata_2007-06-21
    An axample how the output can look like is here:
    http://alf42.dyndns.org/oost/temperature_diagram_example.gif

    hi
    i have tried the code for it and i am getting the
    barcharts but not the graph as the output
    Your code is rubbish. You also did not use code tags. But let's examine the rubbish points shall we?
    import java.awt.*;
    import javax.servlet.*;There is no need for you to import servlet here. Especially as this later appears to be an applet.
    import java.lang.*;Importing java.lang is redundant.
    import java.applet.*;
    public class classfile{This is a poorly named class for several reasons. One it does not follow conventions, class names should begin with a capital letter. Two classfile is just a stupid name.
    Also your class should most likely extend applet if indeed you mean to write an applet. This is probably pointless because you probably don't mean to write an applet, it's just that you have no clue.
    >
    int n=0;
    String lable[];
    int value[];
    blic void init()
    try{
    n= Integer.parseInt(getParameter("column"));n is pointless since everything is hardcoded anyways for four elements
    lable = new String[n] ;
    value=new int[n];
    lable[0]=getParameter("lable11");
    lable[1]=getParameter("lable12");
    lable[2]=getParameter("lable13");
    lable[3]=getParameter("lable14");
    value[0]=Integer.parseInt(getParamater("c1"));
    value[1]=Integer.parseInt(getParamater("c2"));
    value[2]=Integer.parseInt(getParamater("c3"));
    value[3]=Integer.parseInt(getParamater("c4"));
    catch(NullFormatException e )This is garbage.
    System.out.println("Null format Exception");
    public void pain(Graphics g)While I am forced to agree with the sentiment here the correct name for this method is paint.
    for(int i=0;i<n;i++)
    g.steColor(color.red);That is garbage for a variety of reasons.
    g.drawString(lable, 20, i*50+30);
    g.fillRect(50, i*50+20, value[i], 40);
    So try again. Maybe learn some Java first? Just a suggestion.

  • How to plot a graph from text file?

    This is driving me nuts!
    I would like to plot a list of numbers in a text file to a graph. Each munber is on a new line, like this -
    345
    356
    378
    379
    345
    etc.
    I managed to import the file and split it with the 'Spreadsheet to array' function but can't get much further than that.
    Help would be much appriciated.
    Ben H

    You just need to use the Read From Spreadsheet function and wire a 'True' to the transpose input. Wire the 1D array output to a graph.
    Message Edited by Dennis Knutson on 10-20-2006 12:40 PM
    Attachments:
    Read From Spreadsheet.PNG ‏28 KB

  • Writing thermocoup​le data to measuremen​t file from while loop

    Hello,
    I'm trying to write thermocouple data that has already been filtered into a measurement file.  My code works, but has many zero-time entries (probably from the filtering aspect), and some of the non-zero-time entries are even out of sequence (my output file is attached as well as my VI.)  I'd love any help regarding getting this to work!
    Thanks in advance,
    Megan
    Attachments:
    FrontPanel.jpg ‏211 KB
    ThermocoupleDAQ_IOrtiz.vi ‏67 KB
    test1.csv ‏63 KB

    Hi Megan,
    do you really need to sample thermocouple data at 1kHz? How fast does the temperature change - and how fast do thermocouples react on that temp change? (Which sample rate is recommended for your hardware?)
    Are your filter settings reasonable? "TC2 unfiltered" looks quite ok, while the "filtered" graph looks awful (atleast for a TC measurement)…
    And you should definitely fetch a constant number of samples from DAQmxRead. Usually you read 1/10th of the sample rate, so reading 100 samples for 1kHz sample rate!
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • How to exit from while loop

    Hi
        I want to exit from loop if error is encountered.
    THanks

    Hi Sonu,
    This is not a question related to the SDK. This is more of a coding question you should probably try something like StackOverflow or MSDN forums for that next time.
    Regarding your question it depends on the language you are using. If you are using c# you can use the keyword "break;" inside an if that checks for the error. In VB you can use "Exit For" or "Exit While".
    Best regards,
    Pedro Magueija

  • Move plotting to inside a while-loop

    Hi I have a plot that occurs outside a whileloop, and another that is constructed inside the whileloop.
    How do I get the plots to run synchronously in the same waveform chart?
    I've tried looptunnels, I've tried shiftregisters but neither solves it.
    Below is a picture of my attempt to get'em together.
    Hoping for some help.
    Kindest regards,
    Lasse
    Attachments:
    Multi-Function-Synch AI-AO Test B.vi ‏44 KB

    This should do what you requested, but it will keep adding data until you hit stop or memory is full.
    You'd have to add some sort of data truncate function to limit how much history is displayed.
    (The hidden case is 0, it adds the first acquired chunck of data to the shift register)
    Troy
    CLDEach snowflake in an avalanche pleads not guilty. - Stanislaw J. Lec
    I haven't failed, I've found 10,000 ways that don't work - Thomas Edison
    Beware of the man who won't be bothered with details. - William Feather
    The greatest of faults is to be conscious of none. - Thomas Carlyle
    Attachments:
    plot inside.png ‏35 KB

  • Quit from while loop inside a vi that run a while loop

    Hello,
    this is just an example
    i have a led that blink inside a subvi and i what to stop it form the ui of the user (MainHelp.vi)
    but because the subvihelp.vi dont know the stop button it will not stop when i klick on the stop button
    How i can work it out with out using global Var
    thanks for your replay.
    Attachments:
    MainHelp.vi ‏9 KB
    SubVIHelp.vi ‏9 KB

    Hi
    Here is one method to stop a blinking VI in a SubVI.  I tried not to change your version of how the blinking works.  Since the subVI is running continuously this example calls the VI using static reference and using the control names.  You could also use a queue to pass values to the subVI controls.
    Your original VI has a lot of stuff that made no sense, so I cleaned them all out or up, so to speak.
    Good Luck.
    Mark Ramsdale
    Attachments:
    MainHelp.vi ‏12 KB
    SubVIHelp.vi ‏9 KB

  • How can I opearate indicator outside while loop?

    I do small program, I have many while loops and I want to connect wire (in my application) from each loop to AND gate then to another while loop, but how can I operate these wires to agree with the change of my application inside while loops.
    If not clear :
    In another words, suppose I want to operate indicator ouside the while loop. How can I operate indicator outside while loop, so when my application become TRUE (inside while loop) the indicator will be ON (outside while loop) and when my application become FALSE(inside while loop) the indicator will be OFF (outside while loop).
    Help me if you have any idea please..........................

    Hi Rammo,
    For the wire to carry the boolean condition from the while loop to an 'and' gate outside, the while loop must stop running
    If you want the while loop to keep on running and still pass a boolean value to a destination outside the while loop, use any one of these: property nodes, global or local variables.
    i am still not clear as to what you intend to say by this sentence
    " I want the wire that comes out from the while loop will become TRUE if it in my application is TRUE inside while loop and the opposite is true. Because I want to connect the wire that comes out from while loop to AND gate than to another application"
    plz tell me if the first part of this mail of mine answers your doubt or do you need more information?
    regards
    Dev

Maybe you are looking for