LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Avoid array subset & concatenate strings...

Hello,

 

i have these problems....

 

i have to handle some datas and now i use array subset and concatenate strings...

 

i do this operation many many times...and i receive many memory warnings and errors (also for other reasons ofc - but now i would start emproving this part only)

 

in which way can i avoid these 2 functions?

 

PS: i use LV 7.1 - in attachment 1 exaple:)

Using LabVIEW 7.1
0 Kudos
Message 1 of 11
(4,073 Views)

I would guess the problem lies elsewhere. It's easy to create alot of data copies when doing such operations, which might fill up memory.

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 11
(4,068 Views)

This example doesn't say too much... Can you upload more complete code or at least describe in detail what you're trying to do?

Do the error messages are about memory only or there's something else?

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 3 of 11
(4,062 Views)

http://forums.ni.com/t5/LabVIEW/quot-Not-enough-memory-to-complete-this-operation-quot-amp-quot/m-p/...

 

this is my last post...as you can see i have many problems 🙂 but i can't show you the entire code and i'm not a good labview developer....so i would start changing the simplest things 😄

 

so replace array subset and concatenate strings...if possible 😄

Using LabVIEW 7.1
0 Kudos
Message 4 of 11
(4,052 Views)

I already read that thread. If you are building string arrays there's not much you can do to help, unless all lines are fixed-length.

The keypoint is: what you need to to with these arrays?

Are you sure you cannot read the text file in chunks?

I see in the example you are adding string constants as array elements: are you doing this for every line in the file?

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 5 of 11
(4,034 Views)

all lines are fixed-lenght yeah, but i don't know how many lines are present.

 

well, i have to read my file, read the hex code in a particular column and examinating these codes i have to write the name of codes, give to user some datas, etc.

 

and i have to do this control for almost every line (for tx i have to check some value, for rx frames i have to do other things)

 

my problems are:

1 - i can't use labview as a pro 🙂

2 - my boss told me to use his program changing some subVI only

 

but he want that it works also for huge files...and his program can't do this 😞

 

i'd like to solve all problems, also handling his part of code...but in this moment i don't know in what way read-save-manipulate my data in chunks 🙂

i'm reading many documents in internet but it's difficult understand in what way i have to develop my program

Using LabVIEW 7.1
0 Kudos
Message 6 of 11
(4,027 Views)

From the micro piece of code you published I can only suggest to replace Array subset that extract single element arrays with a simpler Index Array.

Furthermore, all that strings constants added to the array (like Seed Data) may probably be added in a later stage, when formatting strings, although I can't suggest how to do it without looking at the code.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 7 of 11
(4,002 Views)

From the micro piece of code you published I can only suggest to replace Array subset that extract single element arrays with a simpler Index Array.

 

but if i need a subarray of 4 elements is better array subset or use index array and build a new array with 4 elements?

Using LabVIEW 7.1
0 Kudos
Message 8 of 11
(3,969 Views)

If you need a subarray, stick with Array Subset.

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 9 of 11
(3,965 Views)

As pincpanter said Array Subset is the best choice when you need an array as output. For single element selections use Index Array.

 

There is a lot of information available on handling large datasets and it should be relevant for your large file problem. Search for a whitepaper on managing large datasets. In some versions of LV much of that information is in the Help but I am not sure about 7.1.

 

The keys with arrays and strings are to be very careful about any operations which change the size or length.  Both datatypes must have all the elements stored in contiguous memory locations, so size changes often lead to memory re-allocations. Growing strings and arrays can leave memory so fragmented that no sufficiently large block of memory is available, creating errors or crashes.

 

Lynn

0 Kudos
Message 10 of 11
(3,935 Views)