LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Replace a 2D Array in Original Array

 

I read N rows at a time from a file and I would like to replace a 2D array(Spike template) in original 
array only in specific index read from a spike list index.
LV 8.6
Thanks for your help. 
Attaching Vi and txt file.

 

Hi,

 

I read N rows at a time from a file and I would like to replace a 2D array(Spike template) in original array only in specific index read from a spike list index.

 

Thanks for your help. 

Attaching Vi and txt file.

LV 8.6

Download All
0 Kudos
Message 1 of 8
(3,394 Views)

Hi wasabi,

 

why do you need a while loop?

19865i07F3ABDB1C07182B

Best regards,
GerdW


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

 

because I need to read N rows at a time. For example, if I choose N = 100
I should replace the spike template from the 10-th to
19-th line of the first 100 rows of the original array, then I should replace the spike template from 
160-th to 169-th of other 100 rpws of original array (from 100-th to 200-th row).
i hope it is clear.

 

Hi GerdW,

 

Because I need to read N rows at a time. For example, if I choose N = 100 I should replace the spike template from the 10-th to19-th line of the first 100 rows of the original array, then I should replace the spike template from 160-th to 169-th of other 100 rpws of original array (from 100-th to 200-th row).

 

i hope it is clear.

0 Kudos
Message 3 of 8
(3,369 Views)

(This is a continuation of this thread. )

 

Your VI will not work. All that you're doing is replacing a subset in the current chunk, which gets thrown away in the next iteration of the loop. You are STILL ignoring the pre-allocation method I showed you in your original thread. I have no idea why you keep doing this.

0 Kudos
Message 4 of 8
(3,353 Views)

 

I've tried this solution in my complete vi. It is attached. I read only N rows at a time, manipulate data and generate by using not allow regeneration. 
All this to avoid memory full. I have tried with file of 170 MB and work fine
Now i want to replace a spike template(2D array) in specific index read from Spike list Index. 

 

Hi smercurio,

 

To avoid memory full, I've tried this solution in my complete vi. It is attached. I read only N rows at a time, manipulate data and generate by using not allow regeneration. 

I have tried with file of 170 MB and work fine.

Now i only want to replace a spike template(2D array) in original array only in specific index read from a spike list index.

 

thanks for helps! 

 

0 Kudos
Message 5 of 8
(3,344 Views)

anybody can help me?
i'll try again to explain problem if it is not clear.
I will appreciate any kind of help.

0 Kudos
Message 6 of 8
(3,329 Views)

 


@wasabi22 wrote:
anybody can help me?
i'll try again to explain problem if it is not clear.

Please be aware that this community is made up mostly of volunteers, many of whom, like me, have full-time jobs. We cannot be on-call 24-hours a day. Please be patient.

 


Now i only want to replace a spike template(2D array) in original array only in specific index read from a spike list index.


I'm sorry, but I have no idea what this means.

 

 

General code comments:

  • Instead of using for-loops to create initializiation arrays, use Initialize Array function.
    For example, this:

    becomes this:
  • Do not insert extra blank spaces and new lines in enum values. If you want to format a list selection for a top-level VI, then use a different control at the top-level. Enum values should not have linefeeds and extra spaces just so they line up neatly when the text is centered.
Download All
0 Kudos
Message 7 of 8
(3,318 Views)

Thank you very much for helps and advice. 
I will try to explain better. 
I want to make a new [(File lenght)*9] 2D array where i want to substitute a 10*9 2D Array (called Spike template) in Original Array (that i read from file I01.txt).
I would like to substituite this 2D array(called Spike template) starting from specific indexes.
This indexes are 10, 160, 2152, 2628......

So i would like a new array where first 9 elements is the same of original array. Then from 10-th to 19-th there

is 2D array(called Spike template) and then from 10-th to 159-th the same items of original array and then from 160-th to 169-th there is 2D array(called Spike template) and so also for other indexes until the file ends.

 

I hope it is clear enough.
Sorry for my bad english.

 

I've attached vi and txt file in previous posts.

Best regards

0 Kudos
Message 8 of 8
(3,306 Views)