LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating then saving an array

I'm thinking I can take my three data (time, volume, d(volume)/dt), build a 1x3 array, insert that into a master array, and then save that master array.  This has some complications, though, because I don't know:

a) how to pass an array from one iteration of the state machine to the next.
b) how to initialize the matrix

Is there a better way?  If not, how would I do this?
0 Kudos
Message 11 of 15
(564 Views)
What about this?  20 and 40 are dummy signals, don't worry about those.


0 Kudos
Message 12 of 15
(562 Views)
What you have shown would work.  To initialize the array, you would wire an empty array into the initialization node which looks like a dot in a box on the left side of the loop in line with the feedback arrow.  If you don't have one, right click on the feedback arrow and selection initializer terminal.
 
In general, and I think most others would agree, is that shift registers are easier to use and read.  If you wire to the right edge of the loop, you can turn the tunnel into a shift register through a right click.  Another arrow will show up on the left hand side which is the source for the next iteration of the loop.  You initialize the shift register by wiring into that left hand arrow from the outside of the loop.  If you leave it unwired, it is called an uninitialized shift register.  It will have a default value the first time the loop is run.  But will retain its previous value from the last time the loop was run even if the loop has been stopped and restarted.  Functional global variables (what some call LV2 style globals) take advantage of this feature.  You can search the forums for either of those 2 phrases to learn more about them.
0 Kudos
Message 13 of 15
(559 Views)
I think I have another idea.  I'll just put the whole state macine itself in a while loop alongside the "Save Stuff" express vi.  Since the state machine's while loop won't pass data until it's done executing, the "Save Stuff" express vi won't save until the state machine is finished executing.

And I'm slowly catching on to the power of shift registers.

This would all be so much easier if I could just write in assembly.

Message Edited by bmunden on 04-19-2007 11:01 PM

0 Kudos
Message 14 of 15
(556 Views)
Actually, I think I finished the first draft?
Download All
0 Kudos
Message 15 of 15
(552 Views)