06-08-2015 12:27 PM
Hello all. I have my Vi attached that does nothing more than feed an output voltage from 1-5, every 3-seconds, unless the stop button is pressed. I don't like the stop button I chose because, if accidentally put in the true state prior to running Vi, it throws up an error I am not sure how to recover from. However, that isn't what my concern is, at the moment. I will try to fix that on my own first. What I am unsure as to do now is how to write a value from each of the case structures onto a spreadsheet. I tried using arrays and store the data from each case structure to a location on the array, without any luck. I have gone through the Core 1 section on arrays to see what I am doing wrong, didn't help me. This has to be much simpler than I am making it. First, am I correct assuming I must first write this to an array, then transfer the data at the end of the Vi cycle, or should I have it write directly to a spreadsheet after each case structure closes? Thank you much.
Solved! Go to Solution.
06-08-2015 12:40 PM
I'm not exactly clear on what you're writing in each state. (i.e. are you really writing a spreadsheet or is Write to Text more appropriate?)
Seems like you can accomplish what you want with Write To Spreadsheet and make sure to wire the Append to File input to True instead of false.
As always post your attempts and we can correct from there.
06-08-2015 01:02 PM
The Vi will output 1 volt after "initiate" is pressed. It will wait 3 seconds then change to 2 volts, wait 3 seconds then change to 3 volts......until it runs its last one which is 5 volts. After it is done, the output goes back to 0 volts. What I am trying to do is collect the data after each case structure completes. This Vi is for me to learn the NI DAQ device. For now it is just an output voltage however, after I figure this out, I will then add an input voltage as well. But for now, I am just trying to get it to write each voltage from each case structure onto a spreadsheet.
06-08-2015 01:10 PM
Seems pretty straightforward.
Go ahead and post what you've got.
I think you'll likely want to use a shift register for the spreadsheet file path.
Seems like you may want to use Build Array prior to using the Write To Spreadsheet.
From your description, I would include a Write To Spreadsheet in each case that you want to record data.
06-08-2015 01:16 PM
This is where I am at.
06-08-2015 01:31 PM
OK. So you've set it up so that it will only write the spreadsheet when you exit.
I don't really recommend this approach since you will have to collect all of your results in an array and then perform a single write at the end.
It's unclear how big that array might actually get.
If you wire a path into the Write to Spreadsheet function, then you won't be promped for it.
You will also need to wire the data that you intend to write into the Write to Spreadsheet function.
In any case, whether you do a write at the end or whether you write during each state, you will need to wire the data that you want to write into the Write To Spreadsheet function. If you're doing this on a state by state basis, you can wire in a 1-D array each time you write. If you're doing a write at the end, you should send in a 2-D array.
06-08-2015 01:34 PM
I apologize for sounding dumb but I am not sure what you mean, not sure how to do what you are suggesting.
06-08-2015 01:42 PM
if you're going to write at the end (i.e. outside of your while loop):
If you're going to write during each case as you generate data (i.e. inside your case structure):
06-08-2015 02:40 PM
I have tried without much success. I can't seem to get the wiring of the terminals correct even.
06-08-2015 03:41 PM
When I run it, nothing is on my spreadsheet. I am not sure how to connect my array to the value that is being output