LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to graph array elements with waveform chart?

Solved!
Go to solution

Hi all, 

I just began learning Labview, with not much programming experience aside from a course in MATLAB, so i apologize if my question does not sense\not enough detail

 

There is something i am trying to do:

I have a 1D array with 1001 indexes, and i am now trying to find a way to output (or plot on a graph) each of those indexes (starting at index 0) sequentially. 

 

Could someone please help me understand how to do this?


I attached an image of what i tried to do based on what i could learn from some google searches and youtube videos, but my graph does not appear correct - it seems to spike up and down between timesteps

 

(please see attached images)

 

thanks!! 

 

 

 

Download All
0 Kudos
Message 1 of 5
(5,785 Views)

You are doing way too much work. A chart already contains a history buffer, so there is no need to build an array.

 

All you need is a single FOR loop. place the chart terminal inside the loop and wire the array across the loop boundary, so it is autoindexing. Place a reasonable wait inside the loop and press run. That's it! (The FOR loop will stop once the array runs out of elements. No need to wire N).

 

See how far you get. 😄

0 Kudos
Message 2 of 5
(5,764 Views)

Here's what I had in mind.

 

chartIt.png

0 Kudos
Message 3 of 5
(5,759 Views)
Solution
Accepted by topic author bkcw95

To summarize, here are a few more comments about your code:

 

  • There is a +1 primitive.
  • You get the same incrementing integer by wiring from the iteration terminal.
  • Watch your representation. Use appropriate datatypes, for example the index should be blue. (see the red coercion dot and the index?).
  • Again, autindexing is the correct way. Now you don't even need to wire N.
  • You can show the digital display of the chart. No need for the "element" indicator.
  • If you build the array in a shift register as you did, you would use a graph, not a chart. Make sure you know the difference!

 

 

0 Kudos
Message 4 of 5
(5,744 Views)

Thank you altenbach!! 

0 Kudos
Message 5 of 5
(5,736 Views)