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: 

can't plot a point at zero

I have a code where I am plotting y versus x. I have elapsed time set up to 60 seconds. When this hits zero, it enters a case structure which has a VI in it that records the current x value for time(I have a timer set up) and y value and plots them. The only problem is that it leaves me with a data point at 1min but no data point for time = 0 when the code started. The only work around I can find is to put a second case in where if the total time < (very small number) it plots a point on the same graph. This is fairly inefficient im sure to have my code running through an extra case, even though its a simple one and I was wondering if there is any way to eliminate this problem?
0 Kudos
Message 1 of 8
(2,913 Views)

I am not good at reading long and complicated descriptions.

 

Could you instead just attach a small VI that demonstrates the problem?

 

(Maybe you could e.g. do a boolean ["i==0" OR "time elapsed"] as a case selector)

0 Kudos
Message 2 of 8
(2,904 Views)
Sorry, wasn't on a computer with labview earlier. I have version 8.2 Here is a snippet of my code that I am having the issues with. Also, since I am new to labview and have just been teaching myself at work, any advice would be much appreciated on making any of what i posted more efficient or cleaner etc. I know a state machine may be best because the code is a little too horizontal for my liking but it works so I'm not going to complain too much 🙂 Thanks in advance. 
0 Kudos
Message 3 of 8
(2,877 Views)
Typical sin, forgot attachment 😕
0 Kudos
Message 4 of 8
(2,875 Views)

Are you running this with the "continuous run" button??? 😮 Don't!

 

(Have you tried my boolean solution mentioned above?)

 

 

0 Kudos
Message 5 of 8
(2,858 Views)
Nope, im not using the continuous run button and no i haven't gotten around to trying the boolean. I will try that this afternoon. Thanks for the advice.
0 Kudos
Message 6 of 8
(2,849 Views)

You don't have to use seperate logic for the case where time is zero.

 

Instead, you can sneakily assign your start time to be exactly equal to the present time minus one data recording interval. This way, the clock starts at the elapsed time and intstantly records a point.

 

See the attached VI. There is a version saved for labview 8.0, and one saved for labview 8.6.

 

 

 

Cheers

-root

Message Edited by Root Canal on 10-21-2008 02:06 PM

global variables make robots angry


0 Kudos
Message 7 of 8
(2,844 Views)

Hi,

 

Like you admitted, using a State Machine would be ideal in your case (and would also make it easier to understand Smiley Happy )

 

In you case you can just use a select case and check if the time is less than a minute or more than a minute. Use the time less than a minute as one of the states and time more than a minute as the next state. This way your code gets more concise, don't have too many cases structures and you dont have local variables.

 

Let me know if you have more questions about this!

 

Warm regards,
Karunya R
National Instruments
Applications Engineer
0 Kudos
Message 8 of 8
(2,833 Views)