From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to save a chart after each iteration in a for loop?

Solved!
Go to solution

Hello,

 

I have written code which initializes a spectrometer. Once initialized, if the "Capture" button is pushed, the spectrometer takes a new spectrum three times (see for loop) every second. This spectrum is displayed as a chart in my front panel. My code runs fine...it will update the spectrum every second.

 

However, I want to be able to save each of these three iterations as separate graphs. Basically, I want to click "Capture" and have my code save three charts to a specified folder. How do I go about doing this?

 

I've attached my VI.

 

Thanks.

0 Kudos
Message 1 of 5
(2,484 Views)

Do you want just a picture of the graph or do you want to save the actual data?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 5
(2,473 Views)

Ideally, I'd like to save the actual data.

0 Kudos
Message 3 of 5
(2,467 Views)
Solution
Accepted by Hoatzin

Probably the easist way is to take the data from the for loop and pass it out in an indexed tunnel.  Handle the resulting array of data as you'd like.  You could also do a producer/consumer and write the files as the data comes out.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 4 of 5
(2,457 Views)

Use Build Array to make a 2D Array of your X and Y data and use Write To Spreadsheet File to save the data.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 5
(2,451 Views)