LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Exporting data to spreadsheet from different states in a state machine


@Nadweb wrote:

So each state has a build array and it's own shift register for the data? Do you build an array of all the arrays in the write state?


No, the state machine has a shift register. Each state can add data to the array.

 

I'd keep an array of doubles, because it is an array of doubles. I wouldn't put things in a waveform, flexible data container or whatever. It is an arrya of doubles, so put it in an array of doubles.

 

When time comes to put it in a graph, you can still simply use the array of doubles. Or convert to whatever you feel needed (, even though it's not).

 

It seems that often structures like a waveform are used because they are simple. They're not. They are an unnecessary abstraction. 

 


@Nadweb wrote:

I was trying to incorporate a consumer loop for the writing. Can I enqueue the arrays in a state so they can be written in the consumer?


Yes. That would be perfectly OK.

 

If your data rate is low enough, it is again an unnecessary abstraction. Optimize when and where needed...

0 Kudos
Message 11 of 13
(344 Views)

@Nadweb wrote:

Hi RTSLVU,

 

1. The acquisition rate is variable depending on the usage, but anywhere from every second to every minute is probably the right range. And the data collection could go on for days at a time. So not very fast.

2. I think I did it to get a time stamp with the data? It was months ago that I wrote that code, and I took it from another VI, so I don't exactly remember what I was thinking. But I do need to plot the data with a time stamp. I've never done it with a For Loop

3. Fair enough. It's really the only way I know how to get my data into a spreadsheet at the moment. I haven't had lots of success with the lower level VI's for writing to a file.

4. I will change!

5. Maybe not, but this made the most sense to me.

 

Appreciate your thoughts here!!


  1. A 1 second acquisition rate is slooooow you are over complicating this
    1. Queues and TDMS streaming are for high speed data acquisition
    2. Think taking measurements thousands of times a second!
  2. A simple state machine should suffice with states like...
    1. Initialize instruments
    2. Open data file
    3. Take measurement
    4. Display measurement
    5. Save to file
    6. Interval Timer
  3. Use the "Write to delimited spreadsheet" vi to write to a Tab or Comma delimited text file
    1. Excel will have no problem opening this and your data will be in columns
    2. Use "Get Time in Seconds" and convert it to a Double and use that as your time stamp
      1. Excel can convert the double back into a date/time by highlighting the column ans selecting "Format Column"
  4. I like using an X-Y chart.
========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 12 of 13
(334 Views)

Also I can't test this because I don't have your VI but if you are still wanting to do that waveform conversion thing...

 

This should do exactly the same thing with a lot less code.

ForloopCapture.PNG

========================
=== Engineer Ambiguously ===
========================
Message 13 of 13
(326 Views)