Swordfish78 wrote in message news:<506500000005000000FD820000-1023576873000@exchange.ni.com>...
> Yes, but is there a way to see the graph being updated as each new
> data point is collected? If you add a timing delay to the loop,
> you'll see that the example VI you pointed to doesn't do this.
Hi Swordfish.
the answer lies in some innefficient codeing. You effectively need
to use the graph as a chart. A chart works by keeping a history of the
data previously written to it, so this is what you need to implement.
Start with an X-Y graph on the front panel.
On the diagram, drop a for loop, set for say 50 iterations, with the
graph inside, and a wait until next ms sub vi set for say 100ms.
Put the xy-graph FPTerm in the loop, and create a shift register.
Right click on the graph, and Create-> Constant. Wire this to the
shift register on the input side (left) of the loop. (will be an
array, zero length of a cluster of two doubles.) Wire inside the loop
to the graph.
Now for some data. Drop down the sine and cosine mathematical sub
vi's, and wire the index of the loop to the convert to dbl sub vi.
Wire this output to the inputs of the sine and cosine vi's. From the
outputs of these two vi's, put them into a cluster (useing bundle).
Finally, you need the array size, and a insert into array vi's.
From the graph FPTerm (which is now wired to the shift register input
side) wire this to the array input on the insert into array. Also wire
this array into the array size vi. Wire the array size output to the
index input in the insert into array vi, and wire the cluster created
earlier into the n-dim array input.
Finally wire the output of the insert into array vi into the output
side of the shift register.
I have the .vi if you want to ask me away from the newsgroup, as I
can't add attachments from here.
The reason it's innefficient is you're permanently re-sizing the
array, and after a large amount of manipulation, this method starts to
slow down. (The bigger the array, the harder it is to find continuous
space in memory to put it in). It's much more efficient if you know
how much history you need, and create a "history" array this size. You
can then manipulate the data, moving it one step back each time, and
putting the new point on the end. This way the array doesn't change
size.
Hope that helps
Sash.