LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to save time as on graph?

How can I save to my .TXT file time in form from 0,1,2,3,4 (as on graph)..... and not computer time, as I have now (see picture bellow)

 

Capture.PNG

_________________________
Rookie; LV 2011 on WIN 7
0 Kudos
Message 1 of 7
(3,030 Views)

I don't see 1,2,3, etc on your graph, thus i cannot tell what you actually want. Please clarify!

 

Is this code in a loop? Is it in a subVI? If it is in a loop, you would substitute the iteration counter for the time code. (but if it is in a loop, you should not constantly open and close the file with every iteration, right?)

Message 2 of 7
(3,021 Views)

Well, what I want is time in form: 1,2,3,4,5,6..... and not computer time aka 19:34:12 .....19:34:13 ..... as I have it now. May graph is normal "waveform chart".

_________________________
Rookie; LV 2011 on WIN 7
0 Kudos
Message 3 of 7
(3,018 Views)

You only write one row at a time, so you need something that keeps track of count (This could be e.g. a feedback node that increments with each call).

 

This is easy, but unless you show us the rest of the code, it is difficult to tell what's best for your situation. I also added more question to the previous post.

0 Kudos
Message 4 of 7
(3,015 Views)

Well yes, this is all in "while loop". If i move "open/create block" outside of the block, then always when I run my VI asking to replace my file??? I set on this block option "open or create". I know it's not OK to do open and close every iteration.

 

My code is very big (I don't have subVI). I have 3 while loops (each one of them for different instrument), together is complete system. All is working.In this program for example I start with first instrument, then manually start second instrument and so on.

 

In beginning I want to make that from 2 while loops (third program is just camera-it's just taking snapshot) create one .txt file (data logging). But it was impossible for me, because I have two while loops and I have to do somehow communication with these two loops(I tried to do this but I was unsuccessful)

 

So I create for every while loop, separate .txt data logging. It's working fine, but now I need to create some graphs in Excel. There I have problems that time is in form: 23:05:12. I must show in one graph data from both while loops. So I was thinking to save time in form 0,1,2,3,4.... . But I think that there will be also problem, with these two while loops. Because if I started first program and then after random time second program(some measurement program), second while loop will not known time from first loop. (now it knows, because computer time is same for every while loop).

 

I hope you understand my problem, is there any example or anything, I can share my code to PM (cannot publish to web).

_________________________
Rookie; LV 2011 on WIN 7
0 Kudos
Message 5 of 7
(3,012 Views)

@hlod wrote:

Well yes, this is all in "while loop". If i move "open/create block" outside of the block, then always when I run my VI asking to replace my file??? I set on this block option "open or create". I know it's not OK to do open and close every iteration.


Of course you also need to move the "close" block outside. You need to keep the file ope for the duration of the program. Most likely you are breaking a reference so it is invalid in the next iteration of the loop. This could be due to the failure of wiring the reference across all cases of a case of event structure or similar.

 


hlod wrote:

My code is very big (I don't have subVI). ... But it was impossible for me, because I have two while loops and I have to do somehow communication with these two loops(I tried to do this but I was unsuccessful).... But I think that there will be also problem, with these two while loops. Because if I started first program and then after random time second program(some measurement program), second while loop will not known time from first loop. (now it knows, because computer time is same for every while loop).


It seems the numbering is the least of your problems. There are major other issues that you should work out.

 

If only one loop is writing to the file, you could keep a counter in a shift register that increments whenever a file write occurs.

0 Kudos
Message 6 of 7
(2,976 Views)

No 2 of 3 while loops writing to 2 different file. I want to write it into same file (both while loops have also a lot of cases and flat sequences...), for these reason I'm writing to 2 separate .txt files with "computer time" (I must analyse this data in excel and also show them on same graph, for these reason I need same time for both while loops).

_________________________
Rookie; LV 2011 on WIN 7
0 Kudos
Message 7 of 7
(2,967 Views)