LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to limit size of an array?

Solved!
Go to solution

I only want a carton that can hold 12 eggs. I don't need an infinite amount of egg. If you want that, maybe it's a good solution for you. But that's not what I'm seeking

0 Kudos
Message 11 of 36
(1,348 Views)
Solution

@User002 wrote:

This is my first week with labVIEW, so I'm a little confused


This is not a LabVIEW problem.

 

LabVIEW is a very powerful programming language and a good programmer can do anything with it.

 

You can initialize an array with a given number of elements and replace them one by one or you can auto index at the output tunnel of a for loop to create that array. Either way, the compiler will know the final size and allocate accordingly. You don't even need to worry about that.

 

Really fixed size arrays are important in special cases (FPGA!) Where LabVIEW supports that fully.

 

 

0 Kudos
Message 12 of 36
(1,346 Views)

That is not the problem I was asking about. If you forget what I was asking already, you can reread the original post. If you can't or don't want to answer, that's fine. I'm not here to argue about what you'd rather do. I'm just here to see what I can do using my sets of constraints. I prefer less replies if you can't contribute to the conversation

0 Kudos
Message 13 of 36
(1,343 Views)

Hi chuck,

 


@User002 wrote:

If you forget what I was asking already, you can reread the original post.

 

I want to build an array of a certain size by loops stopping when the array is full.


array = []
repeat
 append element to array
until arraysize=12

 Some pseudocode.

Keep in mind: building an array using BuildArray and a shiftregister is less efficient then what Altenbach suggested initializing an array and replacing one element after the other), especially when array sizes grow larger!

 

(When you want to improve your LabVIEW skills you also should take care of such sugeestions…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 14 of 36
(1,322 Views)

Can this method filter out data I don't want in the array though?

0 Kudos
Message 15 of 36
(1,319 Views)

Hi chuck,

 


@User002 wrote:

Can this method filter out data I don't want in the array though?


IF condition is met
  append element to array
ENDIF

Again some pseudocode: only append elements when your condition is met!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 16 of 36
(1,322 Views)

Wouldn't that be using Boolan logic? 

0 Kudos
Message 17 of 36
(1,289 Views)

Hi Chuck,

 


@User002 wrote:

Wouldn't that be using Boolan logic? 


How else do you want to implement a decision in software when you don't want to use a comparison function and a case structure?

You want to collect data conditionally, but you don't want to implement that condition???

 

Why don't you use boolean wires???

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 18 of 36
(1,287 Views)

Because that's not what I'm asking. If you can't answer my question as I asked, you don't have to respond. I'm taking altenbach's method instead

0 Kudos
Message 19 of 36
(1,283 Views)

Hi Chuck,

 


@User002 wrote:

I'm taking altenbach's method instead


Which involves checking a condition. See how far you get when you hesitate to implement condition checks...

 

Good luck!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 20 of 36
(1,279 Views)