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.
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.
04-14-2014 02:36 PM
Hello,
I have a vi (see attached) that writes data to a file every n iterations. If the iteration is a multiple of n, the data are sent to a file; if not, to a dummy array. When I open my data file, I find the data I sent every n iteration but I also find 0's in all the rows that do not contain data from n iterations.
Example output if n = 5:
0.1
0
0
0
0
0.2
0
0
0
0
Could someone help me understand why the memory for these unwanted data points is allocated to my data file?
Thank you.
04-14-2014 02:50 PM - edited 04-14-2014 02:53 PM
You have to wire a data value for every part of your case statement. You left them unwired which defaults to "Use Default If Unwired." [Note: The default value for the "Double" data type is 0.0. This explains why you are seeing the zeroes in your output]. Right click the tunnels out of the case structure to disable this feature. Then you will be forced to connect data to all cases and prevent these unseen semantic errors.
Read more on it here: http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/input_output_tunnels/
You can try manually building your own array without using the case structure or auto-indexing for your for-loop outputs. Instead, just add an element to an array within the case structure if it meets your criteria. Does that make sense? There may be a more elegant way to go about this, but this is the first that popped into my head and should be pretty easy to implement.
04-14-2014 04:00 PM
I can't see your code due to newer version but can you use a conditional auto-indexing tunnel? Right-click on the tunnel and make sure conditional is selected and then provide the conditions.
04-15-2014 06:55 AM - edited 04-15-2014 06:55 AM
You definately want the conditional output terminals here. Since you are using LabVIEW 2013, you are good to go with them. Just right-click on your output tunnels and select the Tunnel Mode->Conditional. You will see a little ? appear with the tunnel. Wire in your write condition there. With these, you don't need your little case structure either.