Chazzzmd wrote:
Can someone please help me. You ever spend a bunch of time on something that you know is easier.
BTW-I'm using V8.5 and still fairly new to LV
Chazzzzmd,
Could you attach your latest attempt that shows the problem mentioned in your last post:
"The plots are being displayed but there's one line connecting the 2 plots. That and they are the same color even though I've picked 2 different colors in the plot legend"
This is probably easy to solve once we see the code. 🙂
General comments:
You seem to be coming from a matlab background and thus use mathscript excessively. Many times it would be much easier to do things with wires.
The code you posted shows some very serious beginner errors that make the code overly complicated and seriously hurt performance and debugging ability. The attached VI shows some simple attempts to fix some of the more glaring problems. I have not touched the big mathscript nodes, but they would be easy to do too.
-
Your sequence structure has no purpose because execution order is entirely determined by dataflow.
- Your terminals are in the first frame while local variables of them are inside the loop. This just causes extra data copies in memory for no reason at all. delete the local variables and place their respective terminal in their place.
- Your while loop cannot be stopped and spins at full speed, most of the time repeating the same calculation over and over again and using 100% of the available CPU. Place an indicator in the iteration terminal for the proof! 🙂
- This also causes flickering of the graph. The graph only needs updating if the data changes!
- All you need is an event structure so the loop spins only if one of the controls have changed.
- You have an indicator in one case and a local variable of it in all other cases. Here you can delete all the local variables and place the indicator AFTER the case structure. Makes sense? 🙂
- Similarly, you only need one instance of the property node. Everything that occurs in all cases of a case structure should be outside the case structure!
- Make the "switch position" an enum! This way the cases are automatically labeled, promoting code readability and and eliminating coding errors and additional diagram comments.
- A lot of duplicate code can be consolidated. For example you have three identical FOR loops and "Strings and values" property nodes. One instance of each is sufficient, placed in another FOR loop.
- Most people don't have the luxury of 4000x4000 pixel monitors. Keep the diagram and front panel at a reasonable size.
The attached quick modification draft shows some alternative techniques. Have a look at the green diagram comments, maybe it can give you some ideas. I think the functionality is the same as your code, but I think there are errors. I did not try to fix functional errors, just did some simple Refactoring!
See if things make sense. 🙂 Good luck!
Message Edited by altenbach on
03-12-2008 01:13 AM