LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Doubt on using build arrays with a shift register

Hi all,

I am trying to build a large 1d array using the build array function. My program includes data travelling through a case structure using shift registers. I am facing Satvikpai_0-1715115217053.png errors. 

 

I am not sure what the reason is for this error to be flagged.

 

Upon close diagnosis, I found that concatenate input was not activated. As the previous array is detected as an element and not an array. The dimensions are messed up. It is being read as a 2d array instead of a 1d array. I am not able to activate the concatenate input for that particular input. 

 

Please refer to this image: 

Satvikpai_2-1715115376827.png

 

Can someone please help me with this issue. I am attaching my VI. below for reference.

 

Please ignore the front panel of this VI.

 

0 Kudos
Message 1 of 6
(499 Views)

Going into your shift register is a 1-D array:

BowenM_0-1715116759917.png

 

Coming out of your monstrosity of a flat sequence structure is a 2-D array:

BowenM_1-1715116836435.png

 

Change the build array there to concatenate your 1-D arrays and it'll fix your problem.

 

 

Now for the obligatory statement: You have a lot of problems in this code from poor design to overuse of local variables. At the top of the forums there is a list of training and resources. You will do yourself a huge favor by spending time learning standard design patterns, breaking your code up correctly into sub-vis, and learning "data flow" design.

 

Message 2 of 6
(495 Views)

Thanks for the reply BowenM.

I will definitely try to go through the training and resources. 

I am new to labview and not familiar with all the functions it has to offer.

0 Kudos
Message 3 of 6
(392 Views)

Learn about Sub-VIs and see repetitive code on your vi. Make your code to fit in one screen if it's getting to big, create a sub-vi. 

When you read different data ID consider reading the whole Bit array then convfert into string when you save it. 

RKO
0 Kudos
Message 4 of 6
(377 Views)

@Satvikpai wrote:

Hi all,

I am trying to build a large 1d array using the build array function. My program includes data travelling through a case structure using...


Satvikpai,

 

Building a large 1d array:

My suggestion to you would be to first define your array size then use replace element as you go; otherwise, your vi will slow down considerably as it gets larger and larger by having to find a new memory location to place the next array (N+1) elements and copy over all of the existing data prior to releasing the current data.

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 5 of 6
(367 Views)

@Minions wrote:

@Satvikpai wrote:

Hi all,

I am trying to build a large 1d array using the build array function. My program includes data travelling through a case structure using...


Satvikpai,

 

Building a large 1d array:

My suggestion to you would be to first define your array size then use replace element as you go; otherwise, your vi will slow down considerably as it gets larger and larger by having to find a new memory location to place the next array (N+1) elements and copy over all of the existing data prior to releasing the current data.


First get it to work, then get it to work fast. 🙂

 

You're not wrong, but LV is much better at handling memory nowadays so most of the time this is a non-issue. (Except strings for some reason) and sometimes you simply don't know how big it is/can be. BUT, if you start to get performance issues your solution is the right one! 🙂

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 6
(344 Views)