05-07-2024 04:12 PM
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 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:
Can someone please help me with this issue. I am attaching my VI. below for reference.
Please ignore the front panel of this VI.
05-07-2024 04:23 PM
Going into your shift register is a 1-D array:
Coming out of your monstrosity of a flat sequence structure is a 2-D array:
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.
05-13-2024 12:06 PM
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.
05-13-2024 01:47 PM
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.
05-13-2024 02:25 PM
@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.
05-14-2024 04:12 AM
@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! 🙂