cancelar
Mostrando resultados para 
Pesquisar então 
Você quer dizer: 

How to generate cycles in a array

Hi,
I need to create a vi such that it takes in two inputs: a 2-d array and a numeric value (number of cycles), and returns a 2-d array where its first-column values increment as usually and second-column values are repeated the specified number of times. For example, if the 2d array is [0,7; 1,8; 2,9] and number of cycles is 3, then the output array is [0,55; 1,56; 2,57; 3,55; 4,56; 5,57; 6,55; 7,56; 8,57]
Is there a pre-existing vi that does this or something similar? Thanks.
Attached is what I can come up with, with two subVIs downloaded from this website. It doesn't work as I wish it would, please help. Thanks.
0 Kudos
Mensagem 1 de 7
3.493Exibições
Hi dathenv...
I didn't understand your Q. How did you get the second column ? From where are the numbers 55,56,57 ?
Tell me more specific how did you get them, and I will try to help you...
Mensagem 2 de 7
3.493Exibições
Ooooops I'm so sorry, I changed the 2nd column of the output in effort to make the question more clear, but I forgot to change the values of the 2nd column of the input. The input array should have values [0,55; 1,56; 2,57]. Output is correct.

(Originally I had 7 8 9 as the values of the 2nd column of the input array, but unfortunately if I make three cycles, 7 and 8 would appear in the first column of the output, so I thought that might confuse the reader)

Thanks in advance for you willingnes to help.
0 Kudos
Mensagem 3 de 7
3.493Exibições
What you really need is a 2-D array built out of two 1-D arrays. For the first 1-D array you extract the 2nd column from your 2-D array and add it to the end of itself the desired number of times (see attached example). The other array can be created by running a for loop for the number of times that there will be data points in the array and taking the array from the increment. These two array can then be combined and transposed to give the output that you want.
Mensagem 4 de 7
3.493Exibições
Here You Go....

Hope it Helps....
0 Kudos
Mensagem 5 de 7
3.493Exibições
This works! Thank you so much!!!
0 Kudos
Mensagem 6 de 7
3.493Exibições
Thank you!
0 Kudos
Mensagem 7 de 7
3.493Exibições