Plotting functions in 2D array on a Graph

Hey all,
As an exercise I am trying to plot 2 functions placed in a 2D array on a graph, but for some reason the graph is only showing one of them.
The functions are : y = 5x+10 and y = 6x - 10.
I really don't see what I am doing wrong here, could anyone give me some more insight?
Thanks in advance,
Michiel
Solved!
Go to Solution.
Attachments:
Oefening20Plot2Graph.vi ‏12 KB

Based on your code, I think what you really want to use is a Chart, not a Graph.  A chart keeps a history, so it just keeps adding on to the data.  A graph will get overwritten each time you write to the terminal.  So you were only graphing a single point for each plot.
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines

Similar Messages

  • Logic of array and plotting functions?

    Hi,
    I started to build versatile acquisition programn with labview (with NI cards it seemed to be the best option) and it took quite an effort to adjust the way of thinking while shifting from other programming environments. I start to see the logic behind the labview but I have serious difficulties on figuring out how the labview's array and plotting functions work. Here's a simple example for replacing array subset and plotting it, which just doesn't work as i'd expect. I thought this would first initialize 10 rows, 1000 cols matrix of which the certain row would be replaced (zero padding when new row is longer than the original). The resulting matrix would then be displayed each row having its own windows in the stacked plot. It seems to do something totally different...
    Attachments:
    koe4.vi ‏303 KB

    As you noticed, "Replace Array Subset" can only replace array elements that exist. If it's not there, there's nothing to replace.
    What you'll need to do is make the array larger by using the "Insert into Array" function. Use this function cautiously though. It requires LabVIEW to dynamically reallocate memory while the program is running, and takes time. If you only do the 'Insert' when needed, you should be OK.
    Use the "Array Size" function to get the size of the array to be inserted, then you can choose between the ‘Insert’ or ‘Replace’ functions.
    Ed
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.

  • I have an array of clusters of 4 numeric indicators and i want to plot 2 of them in a xy graph for the entire array? How can you seperate out 2 of the indicators of each cluster for the entire array

    I have keithley 238 SMU, which when used in sweep mode returns the value in a array of cluster of 4 numeric indicators of which 2 are voltage and current and other two are step size and delay....I want to plot
    I-V curves, how to do that?

    Hello aby
    this could be a possible solution to separate 2 values from an array of 4 elements clusters an create 2 arrays suitable for graphing.
    Hope it helps.
    Alipio
    "Qod natura non dat, Salmantica non praestat"
    Attachments:
    a_solution.vi ‏24 KB

  • Excel & ActiveX: Insert arbitrary columns from 2D array and create graph problems

    Hi there,
    I want to insert data from either a 1D or 2D array from LabView into Excel and create graphs.
    I used the information from the following example:
    http://www.ni.com/example/28934/en/
    and was able to create a new Excel file (I'm using Excel 2010), writing data from an 1D array to a column in excel by creating a while loop and using the first element of the array to write it to a specific cell. I use the counter of the loop to write to the next cell when the loop starts over and always delete the first value, which I write to the cell, from the array until it is empty.
    Now I also would like to write a 2D array - so the first column in Excel should be the first column from the array and so. Here I cannot use the loop counter directly as Excel only counts 1,2,... for the rows, but uses A,B,... to count columns. Also I do not know in advance how many columns my 2D array will contain, so creating a lookup table like (A means 1, B means 2,...) is not really an option (except there really is no other way). Is there a possibilty to convert numbers into letters or some way to 'explain' to the program that column 2 in the array means column B in Excel for example, or is there a way to insert new columns?
    I figured out how to add new Worksheets and as I also need to create a certain number of Worksheets and I know that on standard 3 sheets are present when creating the file, I use the 'add' methode to create every new worksheets before worksheet 3 - I could use the same methode to create new columns in Excel, but so far I didn't find a methode to do so. Or is there a way to enter the whole 2D array at once?
    Then I'd like to create a graph (in case of the 1D arrays a bar plot, when using 2D arrays a 3D plot) to view the data. I found this example:
    http://www.ni.com/newsletter/51339/en/
    -> as I do not have the toolkit I'd like to do it using ActiveX directly, so I tried to do things like shown under the headline 'DIY ActiveX/.NET'
    I tried to load the snippet to a new Excel file but got the error message 'microsoft.office.interop.excel.dll not found' and hence the code is not working. That confuses me a little as I would guess when this dll is not present I cannot access Excel from LabView at all, though my understanding of what I'm really doing so far is quiet limited. ;-)
    Also - as far as I understand from the snippet - when creating a new chart object I should be able the create methodes for it, however when I do a right click on the chart object of an ActiveX Worksheet symbol there are none listed.
    To explain my problems better I added a snippet showing my two problems: The inner of the two while loops shows how I import a 1D array. In the outer loop I seperate the columns. I know that currently this is not working as all data end up in column A of the Excel sheet - so I would need to convert the number of the outer counter to A, B,... or find a different solution.
    Moreover on the snippet I placed an ActiveX Worksheet Property with the Chart Object - as I can see the difference to the Chart Object in the example code from the last link above is the color. However I'm not sure what that means and how to change/ solve this.
    And just to make sure - I know this way the VI does not run as the Chart Object is placed completely wrong - I just did it, so it is included in the snippet.
    I'd be thankful for any suggestions,
    Thanks!
    Solved!
    Go to Solution.
    Attachments:
    ExcelAreaScan.png ‏60 KB

    Hello everyone and thanks for the answers.
    I only have the LabView Student Edition available here - is the toolkit included in it too. How can I check if it is installed/ available and in case it is installed - where can I find it?
    Today I had time to take a look at the example
    Create via ActiveX Labview a XY Scatter plot graph on an excel sheet
    It almost does what I want in terms of creating a graph. The only problem I could not fix, is that in this example a sheet is created where only the graph is present. i'd like to add the graph to a previously created worksheet. Today I tried get this working but it seems I stilll don't really understand what I'm doing, I'll post a snippet of my code as soon as I can access the PC with LabView on it again.
    I also took a look at the other example for inserting 2D attays - it seems to be what I need, I just had no time so far to test it, I'll post an update when I could test it.
    Thanks for the help so far!

  • Would like to use an array of XY Graphs

    I want to display subsets of data on multiple xy graphs, and would like to do this in a For loop. Is there a way to use an array of XY graphs or access them programmatically from the For Loop. I am plotting data and using XY graph properties for cursors, graph colors, visible for each graph.

    Hi All,
    Ben would like to make another suggestions that he does not have time to try out ( to many project, to little time).
    How about using a single XY graph that is "off-screen". Write the data to the graph, adjust its properties as required, then get the "image".
    Do the above for each set of data then combine them in a single Picture control.
    If you track the region where each plot is displayed, you can watch for clicks on the picture, figure out which plot the user clicked on, then move the data for that plot into that single "off-screen" graph before programatically moving that plot such that it over-lays the part of the picture where its image was presented.
    Once this app is whipped up (provided all of this works) you could have as many graphs as you
    want and have the grpahics/cpu horsepower to drive. The user could do everything with this plot as usual.
    Sharing my thoughts,
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • How could I plot 2D images or arrays serie to 3D object in LabVIEW?

    Hello, everybody.
    I would like to ask you guys about plotting 2D images or arrays series into a 3D graph or object or any possible.
    If I have serie of 2D arrays (It's 3D). For example, the 3D array contains 500 (z) x [ 500 x 500 (x and y)].
    Could anyone tell me the possible way to do this problem?
    Thank you very much .....
    Racha

    Hi rachacha
    I have been investigating about your question and I realized that we have a document with one example that it use different 2D picture for building a 3D object. I belief it will be useful for you.
    ->>  https://decibel.ni.com/content/docs/DOC-4765
     

  • Power fit function is not fitting correctly to sub-array controlled by graph cursors?

    I am using two cursors on an XY graph to select a subset of the graphed data to fit a power function to. I noticed that the first selection cursor (left-most on the graph) seems to have more control of the amplitude and power of the power fit while the second cursor only seems to limit the "range" of data selected (i.e. does not have much influence over the fit, even though it should).  When comparing the exact same data in excel using a power fit, the excel fits a completely different line.
    Any help would be much appreciated. (please disregard the local variables in my code, only been at this 3 months) I have attached the VI as well.
    Excel fit:
    Attachments:
    Hg Cp.vi ‏83 KB

    Two suggestions.  Change the default parameter bounds.  Specifically, the offset upper and lower limit are both 0, forcing this parameter to be 0.  Change the limits to be Inf for upper limit and -Inf for lower limit.  Also, tighten the tolerance of the fit to be 1E-6 or so.
    -Jim

  • How do you get multiple plots to show up on the same graph?

    I am trying to get multiple (20) plots to show up on the same XY
    graph.  My data set is a 2D array, which exits a for loop. 
    The ultimate goal is to have one plot show up after each iteration of
    the for loop.  I can only get all 20 to show up at once, not one
    at a time.  Any suggestions?
    Thanks!

    Here is a sample in 7.0 format.
    Attachments:
    20 plots on XY graph.vi ‏31 KB

  • How do I plot multiple points (scatter) on the same graph?

    Hello,
    I have a graph with a fixed X-axis and an array of Y values which varies. How do I plot these new y values without replacing the previous ones? E.g to have a scatter of new data? Example of shown in Figure 1 below:
    Figure 1: (Note: image was photoshopped to demonstrate goal) 
    Figure 2: Current block diagram, LabVIEW VI:
    Thank you!
    Solved!
    Go to Solution.

    Think about what you are really building. You are building an array of clusters, right? For each element in the array you have a cluster whos content has a value for the X axis and a value for the Y axis. As long as you are not connecting the datapoints in the graph (which you aren't), you can plot the datapoints in any order. If you are building your X portion of the cluster seperately than your Y portion of the cluster, you just have to make sure the indexes do not get transposed somehow.
    Build the lower half of the attached picture, and you will see what I mean. (hopefully)
    Attachments:
    Chart.PNG ‏21 KB

  • How can I plot data from excel in a XY graph

    Labview experts,
    I have a really simple problem in labview:
    I have some data in excel: 2 columns with a certain number data. The two columns are related to each other. So I want to plot all the points in a x y graph. Coordinates point 1: (row1,col1) coordinates point 2: (row2,col2)...
    Now i want, in a first step, import this data in labview and draw the X Y graph in labview.
    So the points of the first column on the x axis and the data of the second column on the y axis.
    that's how i do it now: Attachment
    That's only working if i'm using a waveform graph, but i want a XY graph
    Is there somebody with a solution,
    Kind regards,
    Jelle
    Attachments:
    tryout.PNG ‏9 KB

    To setup a plot of XY from dual column data in excel, select the two column including the name header for both column and then select to insert a scatter plot with the points connected by lines and Voila you have a 2 axis plot with x and Y dimensions and including the title for the trace from the column header already formatted for you. If you select more than 2 columns then the first is the X dimension and the remaindre columns all become Y axis traces for multiple plot lines for each column. This is easy folks and basic excel functions for plotting. One the graph is created and displaying the data, clear the data and save as a template. Now when you call the template and stuff the columns of data into the table fields, excel automatically updates the plot and all you have to do after stuffing the data in is save the excel file. Task done. Good luck.

  • Unknown array size to graph in LV9

    The attached program is used to measure a device at work, which currently has 3 strips, for an indeterminate length of time. It works fine (though im sure it isnt written to best NI practice!).
    My problem is in trying to change the software to test devices that dont have 3 strips. For example, we have one device that has 128 strips. The majority of the program doesnt need any changes, only changes are essentially to get the graph to plot.
    Ive written on the code where I need some help. The graph is needed to plot the currents over time and also to plot the temperature over time (on the same graph). This is for a quick visual that all is well.
    Or can anyone can point me in the direction of a relevant example?
    Merry Christmas.
    Solved!
    Go to Solution.
    Attachments:
    lifetest with switchbox using array.vi ‏72 KB

    Take a look at the attached vi, does this help you?
    Attachments:
    Variable plots.vi ‏14 KB

  • How to record and plot only the zoomed portion of a Graph or Chart?

    I'm using LabVIEW 8.6 and have problem plotting only zoomed part of a graph or chart onto other. Please help.

    Sorry, your VI makes absolutely no sense. First you slowly generate chart data, then you write it to a file, read it back from a file, do some exceedingly elaborate while loop that could be done with almost no code at all, then chart all data at once again. The stop button in the while loop makes no sense, because the while loop executes so fast that it is not possible to actually stop it while it is running, only if the button has already been pressed during the first FOR loop.
    What is the purpose of the two arrays? They don't seem to serve any purpose. Why are you getting the array size with every iteration of the loop? Once, right before the loop should be enough. Index array is resizable, so only one instance is enough. Instead, array to cluster is probably all you need.
    The sequence structure is only needed because you write, and then immediately read from the file. All you probably need is to write to the file and wire the 2D array to the seconds structure. Now we have a data dependency and the sequence structure is no longer needed.
    Can you tell us a little more how you are zooming. Do you want to zoom any of the two graphs and automatically zoom the other accordingly?
    As it currently stands, only the first chart gets data, so zooming the other one seems useless. Once the second chart has data, the VI stops and you can't do much either programmatically. Please explain how you are zooming.
    LabVIEW Champion . Do more with less code and in less time .

  • How to plot line and bar chart in one graph

    i have one graph, but in this graph i want to plot line or bar chart using radio button selection.
    can i do that...

    You must have 2 data arrays or plots to get this. Make sure your plot legend is visible. Drag the plot legend vertical borders to view both plots. Select one of the plot to be bar plot (See the attachment)
    Attachments:
    BarPlots.PNG ‏14 KB

  • Array of xy-graph references

    Hi all,
    I looked in the forum for a problem that I thought was simple, but I couldn't find anything helpful.
    I'm passing an array of references to XY graphs, from one VI to another. The sub-VI extracts the references when needed and wires them to property nodes. These change the active plot on the XY graph and its visibilty.
    I also tried to pass a cluster of references and convert it to an array inside the sub-VI, but it didn't help.
    I noticed that all the reference wires have a coercion dot on the build array. That may be the key of the problem, even if I can't see how.
    The error I get is:
    Error 1055 occurred at Property Node in make_trg_vis2.vi->main10.vi
    Possible reason(s):
    LabVIEW:  Object reference is invalid.
    The attached files explains the issue. Top.vi calls the sub-VI.
    I hope all this is clear enough. The thing works fine if, instead of using a sub-VI, I use property nodes in top.vi.
    Solved!
    Go to Solution.
    Attachments:
    top.vi ‏53 KB
    make_trg_vis2.vi ‏65 KB

    In your subVI,  you have your index array wired to the N terminal of the for loop.  Perhaps it should be the i terminal?
    N=8.  (Always, every iteration of the For Loop).  You multiply it by 3, then add 1, then another 1.  So you have indices 24, 25, 26.  But the array coming in has 24 elements which are at indices 0 to 23.  Thus you are immediately acting on an empty graph reference at index 24.
    You also appear to have a lot of duplicated cases in your case structures.  For example, cases 3 6 and 7  look identical.  Rather than using 3 different cases.  You can have one case that is 3, 6, 7.

  • Plotting elements from an array in waveform chart

    Hi all,
             I am trying to plot a real time data by extracting single element from an array.
    Problem is that, at some frequencies waveform chart plot perfect while at other frequencies it plots like a undersampled signals.
    Any suggestions?
    Attachments:
    wfm.png ‏136 KB
    wfm.vi ‏133 KB

    The timing information comes from the data acquisition process, not the display. You should be able to get equally good display of timing information on a chart or a graph.
    How many samples do you read at a time? How do you define "realtime"? Anything plotted on a graph or chart for the use of a human operator does not need to be updated more than about 10 times per second because the eye/mind system works at about that time scale. For humans a real time grahical update rate of 2 to 10 Hz is adequate. Then you will have 256 to ~51 new samples at each update.
    Another issue is that both your graph and your plot have plot areas which are less than 200 pixels wide. If you supply more than [plot width] pixels to a graph or chart, LabVIEW will reduce the data to determine which pixels to plot. So your graph with 1000 X-axis values has that reduced to the 184 pixels across the width of the graph. So, regardless of the precision of the data, the "precision" of the display is limited to the number of pixels.
    Lynn

Maybe you are looking for

  • In Select query how to fetch values through multiple parameters  where conditon

    Dear Experts, I have one table(T) with 4 fields: f1, f2, f3, f4. In that based on f2, f3, f4 and parameter condition( f2 values) how to fetch f1 values. I have attached screen shot. What is the where condition in select query? DATA: it_T type standar

  • Shared libraries in Photos 1.0

    My wife and I have traditionally shared a single library in iPhoto (stored on an external drive). Can we continue to do so in Photos? Are there any complications when it comes to shared libraries and iCloud Photo Library? (I could just plow ahead and

  • What api would I use to get the number of chars in string?

    What api would I use to get the number of chars in string?

  • Update statistics for database

    I'm needing to update stats on all tables in the database, and an unsure how to do so, and haven't been able to find any documentation for it. Could someone help me in this, show me the code on how to make this happen. Thanks

  • Need a query to find Grops mapped on Folders

    Hi , I need a query builder query to find out the list  of folder and mapped groups to those folder. Would you please let me know if that is possible I triead but no luck . Regards, Neo