Ni.com is currently experiencing issues that may cause some pages to fail.

Support teams are actively working on the resolution.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to get values out of stacked sequence?

Ok folks, 

 

what do you think about this? Is this better?

 

one more question, you will see the standby state, where it basically waits till it gets either the start or the save command. I have programmed it now with a while loop and a case loop. But if I want to implement a third button, the STOP for instance then my system doesn't work anymore :). There should be a better way to do this.

 

Thanks

Download All
0 Kudos
Message 21 of 35
(1,381 Views)

Hi Kristof,

 

here's a slightly changed version:

- using shift register for "data"

- only one loop (!)

- no local variables

- loop count changed to I32

 

Never compare floating point numbers for (un)equality - things tend to fail Smiley Wink

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 22 of 35
(1,373 Views)

If you could save that to 8.5.1, that would be awesome!

0 Kudos
Message 23 of 35
(1,370 Views)

Already done while editing my previous post...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 24 of 35
(1,363 Views)

Hmmm you guys will not understand me in dutch i guess...

 

so, anyway, I noticed by trying your VI that the data is not plotted in real-time, but after the whole for loop is done...  is there a work around using shift registers or should I just use the locals then?

 

thanks for the other modifications!

0 Kudos
Message 25 of 35
(1,356 Views)

Hi Kristof,

 

???

Do you mind to post in English?

 

From what I understand of your dutch question:

Fastest, but not best, workaround: put a local of your XY-graph in the FOR loops...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 26 of 35
(1,350 Views)

edited it, sorry about that, it's what you get after 24h working 🙂

0 Kudos
Message 27 of 35
(1,348 Views)

Guys, thanks a lot for your help. I think it can still be improved, but this is already way better than before. The whole state machine thing is indeed a nice feature to use.

 

Kristof

0 Kudos
Message 28 of 35
(1,310 Views)

The state machine is still a horrible mess and full of unnecessary code and very dangerous programming steps.

 

 

  • You have case structures where each case contains the same code. Why?
  • You are doing equal comparisons on DBL, a very bad idea! The smallest differences can make the comparison fails. Since you increment fractional values, it is very likely that an equal will never match. Use integers! (or e.g. "greater or equal" when using DBL) Integer is probably preferred. You can calculate the number of integer steps from the control values. (not implemented)
  • Don't place controls before the loop, the can never be read again during the same run.
  • Don't use inner loops. A single outer loop can handle everything. No locals needed.
  • You cannot write complex data to a spreadsheet directly, it will get coerced to DBL and you'll lose the imaginary part.
  • ...
  • ...
Here's a quick draft that could possibly give you some ideas. Many improvements are possible (and necessary!). I would probably use an event structure in order to have the VI react to user input at any time.

 

0 Kudos
Message 29 of 35
(1,296 Views)

 


@altenbach wrote:

The state machine is still a horrible mess and full of unnecessary code and very dangerous programming steps.

 

look at the positive side man, i've come a long way and I am brand new !

 

 

 

  • You have case structures where each case contains the same code. Why?
no idea 🙂

  • You are doing equal comparisons on DBL, a very bad idea! The smallest differences can make the comparison fails. Since you increment fractional values, it is very likely that an equal will never match. Use integers! (or e.g. "greater or equal" when using DBL) Integer is probably preferred. You can calculate the number of integer steps from the control values. (not implemented)
yes i know, i removed them already

  • Don't place controls before the loop, the can never be read again during the same run.
ok

  • Don't use inner loops. A single outer loop can handle everything. No locals needed.
you are actually the first one to really solve my initial problem, I used For loops, but they don't give out their values until finished, so they didn't allow real time plotting unless you use a local, but your way makes the for loop disappear (why do they even exist, same with sequences???)

  • You cannot write complex data to a spreadsheet directly, it will get coerced to DBL and you'll lose the imaginary part.
yes i had to break it up again

  • ...
  • ...
Here's a quick draft that could possibly give you some ideas. Many improvements are possible (and necessary!). I would probably use an event structure in order to have the VI react to user input at any time.

 

 

Thanks alot!

Kristof


 

0 Kudos
Message 30 of 35
(1,290 Views)