11-06-2012 10:22 AM
Hi,
I'am trying to rezise a 2D array (of strings), by keeping only one line every n lines.
I guess I should use the "delete from array function", but after several trial, I can only delete some consecutive portions, not periodically...
Any tips / example for such function?
Thanks in advance
antoine
11-06-2012 10:50 AM - edited 11-06-2012 11:18 AM
If you use "delete from array" you need to start with the highest index, because each deletion operation will shift the remaining lines down, changing their index. However, this is very inefficient.
There have been been many example posted how to do this operation "in place". Why don't you show us your best trial VI containing some typical default sample data?
11-06-2012 10:53 AM
Ahh... I wonder if you have stumbled onto a common issue when manipulating arrays:
If you delete a row from a 2D array, you are actually resizing it. So the index positions of all subsequent rows get reduced by 1.
Anyway, that may not be your issue. We'd have to look at your code.
I would probably just index the array instead of using the delete function (see below). But this method will probably be SLOW if you have a big array. Try it out:
11-06-2012 11:08 AM - edited 11-06-2012 11:10 AM
Here's a quick in-place solution which will be orders of magnitude faster that the one using "build array" for large arrays.
You might need to tweak it a little bit, depending on if you want to keep the first row or not. (e.g. try adding a +1 between the iteration terminal and Q&R)
(Attached VI is in LAbVIEW 8.2)

11-07-2012 02:49 AM - edited 11-07-2012 02:56 AM
Hi,
Thanks a lot to both of you.
I tried both solutions, and both works fine, I'll go for altenbach's one as my array size will be contiously increasing, so faster is better.
I understand that this question was discussed already, sorry for that, but I made a lot of unsuccessfull researches prior sending the post... I think I was missing the good keywords : decimate
On .vi standpoint, I was not that far, but I was missing the function "quotient and remainder" (yes, newbie...)
Thanks again for your help.
regards
antoine