06-08-2016 03:00 PM
Hello!
I am having trouble with a couple things with my program.
1- My original program samples data like an even/odd function so at 12 on the dot it wont sample and as soon as it turns 1pm it will sample. I am trying to fix my program so it isnt dependent on the time, so whenever I run the program it will run for an hour then not run for an hour and do that continuously.
2. My second question is that currently my data is being sent to a text file then I copy and paste onto excel. Since I am running a multiple week test it will be tedious to continually do that. How do I simply export the running data onto a formatted excel sheet bypassing the text file?
Thanks in Advace!
06-08-2016 03:03 PM
Please do not upload a PNG file, upload your actual VI.
06-08-2016 03:32 PM
Attached is the VI
06-08-2016 03:32 PM - edited 06-08-2016 03:33 PM
You are new to the Forums, so might not know/realize that posting a static picture of part of your VI is not very helpful to us. It (a) doesn't tell us what version of LabVIEW you are running, (b) doesn't let us closely inspect Express VIs to see "what is under the hood", (c) doesn't let us look at the "unseen Case" statements, (d) might not show all of the VI (or if it does, might be too tiny to read, and (e) is not executable (so we can't test it).
Thank you for posting your VI -- it overlapped my writing this note.
I'm assuming that you want to sample as long as the elapsed time (in hours) is 0, 2, 4, etc., and not sample if it is 1, 3, ... Suppose you know t0, the time you started your experiment. Compute t1, the current time. t1-t0 is the elapsed time. Express this in time-in-seconds as time-in-hours. Round down to the nearest integer. You now have 0, 1, 2, 3, ... hours. Use the Integer Divide function to decide if it is odd or even, and wire this to your Case statement to Sample or not.
Note you might want to think about "end cases", i.e. what do you do when going from "Sample" to "No Sample" and from "No Sample" to "Sample".
The second question, how to write to an Excel Worksheet (I assume you mean write to a .xls or .xlsx file), has been covered many times in this Forum. There are also examples to be found in LabVIEW (Help, Find Examples).
Do some studying, read the samples, think about how to turn sampling on/off on the hour, write some code, and come back, posting your code (meaning "attaching your VI"). Note that if you have multiple VIs (as you should!), you can compress the folder containing them and attach the resultant .zip file.
Bob Schor
06-08-2016 03:38 PM
We need to see the VI, not a picture.
06-08-2016 03:52 PM
Unless you need a more accurate way of sampling, elapsed time express VI is your friend
06-08-2016 04:09 PM - edited 06-08-2016 04:09 PM
@jetsfan123 wrote:
1- My original program samples data like an even/odd function so at 12 on the dot it wont sample and as soon as it turns 1pm it will sample. I am trying to fix my program so it isnt dependent on the time, so whenever I run the program it will run for an hour then not run for an hour and do that continuously.
I understand that it will sample every 4.8 seconds as long as the hour is odd, then pause for an our and start again if the hour is again odd.
(please clarify if this is incorrect)
Anyway, here's what you could do for problem #1.
@jetsfan123 wrote:2. My second question is that currently my data is being sent to a text file then I copy and paste onto excel. Since I am running a multiple week test it will be tedious to continually do that. How do I simply export the running data onto a formatted excel sheet bypassing the text file?
You did not attach the File IO subVI, so we don't know what you are doing there.