08-19-2014 05:17 AM
Hello there,
I've got an Array1 which contains values indexes more especfically. This array size can be variable from 1 to 20 elements.Then I want to create an Array2, which will increment the value of all the elements by one each iteration except those elements or indexes stored in Array1.
I have tried almost everithing to do it, but I just cannot get my head around this. Any help?
THanks in advance
Solved! Go to Solution.
08-19-2014 05:34 AM
Can you give some example datas for array 1 and 2 with small explanation
08-19-2014 05:44 AM
Sorry..yes of course.
I forgot to mention the arrays are 1D.
As I said the Array1 woudl contain values ie.(2,3,4) that correspond to the indexes that I do not want to increment in Array 2.
So in the first iteration:
Array1=(2,3,4)
Array 2= (1,1,0,0,0,1,1,1,1,1,1)
In the second iteration let is say Array1 changes and is (1,2,3,4)
So Array 2 would be: (2,1,0,0,0,2,2,2,2,2,2)
In the third iteration Array 1 changes again and it is (0,1,5)
Array 2=(2,1,1,1,1,2,3,3,3,3,3)
and so on..
08-19-2014 05:46 AM
08-19-2014 05:49 AM
why in each iteration array1 is changing? and you said you need to create array2
08-19-2014 06:04 AM
Hi GerdW,
I have tried different ways, right now I have a mess of Vi, trying different approaches, will post one as soon as I get a decent result. I will look into your VI thanks a lot.
My array1 is storing the value of the(index) a [previous operation.FYI this operation is just the comparison of two arrays. Each element that mismatches the other element is stored in int. Please see link below, it is similar.
http://forums.ni.com/t5/LabVIEW/Compare-elements-in-an-array/td-p/162750
Anyway that is why I am talking about iterations, array 1 will change every iteration and Array 2 needs to register by incrementing the elements not shown in Array in one unit, every cycle or iteration.
Hope this helps to understand a little bit more my goal
Thanks to both of you
08-19-2014 06:37 AM
Or I was thinking to step back, it probably easier:
What if I have two arrays 1D 10 elements each:
1st iteration)
Array1data(1,30,40,52,52,52,0,0,0,0)
Array2Comp(52,52,52,52,52,52,52,52,52,52)
I want an Array3 registering the matches between the elements of both Array1data and Array2Comp by incrementing 1 each iteration;
Array3result(0,0,0,1,1,1,0,0,0,0)
2nd iteration)
Array1data(0,0,0,52,52,52,52,52,0,0)
Array2Comp(52,52,52,52,52,52,52,52,52,52)
Now the Array3 will update the oveall count with the new matches ;
Array3result(0,0,0,2,2,2,1,1,0,0)
and so on..
Does it make it easier??
THanks
08-19-2014 06:46 AM
08-19-2014 08:43 AM
Hi Gerdw
thanks for your reply.
I am not able to do what I want with your example. Please see attached my attempt. I do not find a way to store the final count incremented 1 by 1 as per every iteration.
The way to handle arrays in Labview, even the simplest operations really do not get into my brain these days
Any advise?
Thanks a lot
08-19-2014 08:46 AM