LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem Reshaping Array

Hi, 

 

Ive been trying to build a 2D array using a for loop.

Seem to be having a problem with one of the arrays not clearing so i included a init array sequence to clear the arrays but it doesnt sort the problem (it will clear the displayed arrays (1d and 2d) but then the data reappears when i run the generate loop again.

 

Im working on this in an attempt to get 3 single values appended to a 2D array (incase theres an easier way of going about this).

 

Any help would be awesome.

 

Thanks in advance

 

Andrew

Capture.PNG

0 Kudos
Message 1 of 6
(3,473 Views)

Read the help about shift register (and feedback loop)  😉 and use it instead of the feedback loop.

Oh, maybe you accidently created that feedbackloop ?

However that feedback will store data!  (if you dont initialize it  even from run to run ) 😄

 

Read the help about the event structure....  no need for the highspeed  button loop, place the buttons into the related event case!

 

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 2 of 6
(3,458 Views)

Thanks Henrik!, ill give that a go - thanks for the super fast response

0 Kudos
Message 3 of 6
(3,454 Views)

I think you want something like this


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 6
(3,450 Views)

All you need is a single while loop, an event structure with one single  event case, e.g. as follows:

 

 

 

General comments:

  • Don't use a timeout event if it does not do anything useful.
  • That greedy loop on top is just silly. Latch action booleans reset when they are read by the code, so they belong inside their respective event case. Your upper loop uses 100% of a CPU core spinning as fast as the computer allows, heating your room and draining your battery. Pointless!  (see also)
  • Use consistent styles for buttons (e.g. all silver) and use the boolean text.
  • Don't use switches with latch actions. They should be buttons.
  • Clearing via a local variable just clears the indicator. Your data is stored in the shift register, so that's what you need to clear. The indicator will follow automatically once there is no data in the wire.
  • Why are your initialized arrays orange if they only contain integers?
  • If you use arrays, you would only need one multiply operation.
  • Indicator don't belong inside fast loops. It is sufficient to update the indicator after the FOR loop has executed. Less UI overhead.
  • Use "built array" instead of "insert into array"

 

 

Download All
Message 5 of 6
(3,421 Views)

Amazing help! Thanks for all of your responses - has been a huge help!

 

Thanks again,

0 Kudos
Message 6 of 6
(3,375 Views)