LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview Lack of data

Solved!
Go to solution
 
 

I used the array to replace the subset vi, but I found that one piece of data was missing. I don't know where the problem lies. Does anyone know? Thank you for your guidance.Could you please help me write a demo?001.png002.png

0 Kudos
Message 1 of 7
(1,191 Views)

I haven't looked at your code closely, but I can say that the value you write into the indicator is the value that you have before the last Replace Array Subset function. I'm guessing that's your issue.

 

It would be useful to learn about LabVIEW's debugging tools, so you can debug things like this yourself. At the basic level, these are things like breakpoints, probes and execution highlighting. Logging is also useful for some things.

 

My own preference for debugging is usually to start with the symptom (the table not displaying your desired value, in this case) and then work backwards from that. In this case, that means that you find where the table has a value written to it and look at what value that is and where it came from and then start working backwards to see where something went wrong. 

 

 

It's probably also useful to point out that you have race conditions. There is no dependency between writing to the A-D indicators and reading from them, so the order is undetermined and in theory, that could also be your issue. It's better to use wires instead of variables if you can to avoid the option of race conditions.


___________________
Try to take over the world!
Message 2 of 7
(1,164 Views)

Your picture shows a gigantic pile of unnecessary local variables. Once you get rid of all those locals and use wires instead, you can then also remove the sequence structure. Also get rid of all that duplicate code. Why do you think you need to calculate the result of "D x A + B + 2" twice in a row? The result will not change!

 

As has been mentioned, there are a lot of potential race conditions, for example there is no guarantee that any of the locals are only read AFTER their terminal is updated.

 

As always, we won't debug images. For example, we cannot tell the array size of your diagram constants. What are the array sizes before the loops? Are the ones inside the loop all the same size?

 

Feel free to attach your VI (do a "save for previous" 2020 or below before attaching). Without it, our help is limited.

0 Kudos
Message 3 of 7
(1,116 Views)
 
 
 

I uploaded the vi.

0 Kudos
Message 4 of 7
(1,068 Views)
Solution
Accepted by topic author 留白
In general, you don't need all these local variables and the sequence structure. Something like this
snippet.png
can be simplified further, for example, you absolutely don't need to fill and overwrite header on each iteration:
snippet2.png
but it depends on your overall design and how you plan to supply the data to the table.
Message 5 of 7
(1,040 Views)

The reason your last number is missing is because you connected the indicator before the last replacement operation. the indicator belongs after! 

 

altenbach_0-1788880064133.png

 

 

Here's what I would do.

 

altenbach_0-1788880569266.png

 

 

Personally, I would probably write the header strings once. I assume that in the real code you will write many more row later, so that should go into a second loop stack.

 

Message 6 of 7
(1,005 Views)
Solution
Accepted by topic author 留白

@altenbach wrote:

Personally, I would probably write the header strings once. I assume that in the real code you will write many more row later, so that should go into a second loop stack.

 


Here's how that could look like. Of course you need to correctly insert your measurement values and settings in the right place.

 

 

altenbach_0-1788882464669.png

 

0 Kudos
Message 7 of 7
(997 Views)