LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Add rows to a 2D array until I have allways the same

Hi,

 

I have a 2D array with data from a sensor, the rows for example starts in 1000 but then starts to decrease cause there are no data. How can I have allways the same rows with for example 0 or NaN or something like that?

 

Here I have a 2D array and a counter in the first. 

 

ADaniel01_1-1679661902542.png

 

 

0 Kudos
Message 1 of 5
(868 Views)

Hi A.,

 


@A.Daniel01 wrote:

I have a 2D array with data from a sensor, the rows for example starts in 1000 but then starts to decrease cause there are no data. How can I have allways the same rows with for example 0 or NaN or something like that?

 

Here I have a 2D array and a counter in the first. 


Why do "rows start to decrease"?

Why do you want "always the same rows"?

That image doesn't help because of hidden wires…

 

  • Please attach a simplified example VI to show your problem.
  • Please give expected results for some given inputs…
  • Please explain the problem more detailed! (You may even use GoogleTranslate when English isn't your first language…)
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(858 Views)

You can use Initialize array with e.g. 1000 elements of NaN, -1 or similar and then use Replace Array to replace part of it.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 5
(825 Views)
  • When you say "starts at 1000", are you talking about the size? (# of rows? # of columns?)
  • What are the two dimensions of the 2D array?
  • How many rows and how many columns? What is fixed and what is variable?
  • Which dimension gets smaller?
  • Why can't you merger the "counter" scalar inside the loop? Are you sure the value is not stale?
  • You are using concatenating tunnels, so the number of rows can be variable and things will fall into place without array gymnastics. Whatever you are currently doing does not look reasonable.
  • Do you want to stop the loop once you have a certain number of accumulated values?
  •  

Can you attach a simplified version your code that simulates typical data?

0 Kudos
Message 4 of 5
(822 Views)

@altenbach wrote:
  • Whatever you are currently doing does not look reasonable.

Here's equivalent code (green) compared to yours(red). Both give the same result, but obviously it's not what you want.

 

Once we know what you actually want, we can modify accordingly.

 

altenbach_0-1679678651057.png

 

0 Kudos
Message 5 of 5
(804 Views)