07-16-2014 09:34 AM
Hello!
I am new to LabView and I am struggling with this problem for a couple of days...
I have a 2D array CH x spike_time and on each row (1D array) I need to implement a logic that requires the possibility to dynamically initialize two indexes.
To be more clear, if I indicate with CH each row of the 2D array, this is the logic I should implement on each row:
i=0;
while i <= N-min_burst_size
{ j=i+1;
while ch(j) AND ch(i)-ch(j) <= Inter_spke_interval AND j <= N-1
{j=j+1;}
if j-i+1 >= min_burst_size then save(i,j);
i=j;
}
What is the best way to implement this logic in labview?
How can I manipulate the value of the indxes i and j to initialize them as in the code? I tried to use the "Subset of Array" function in order to "cut" subset of the row starting from i and j and shift registers to pass the subset again as input of the loop, but I couldn't get to anywhere close to a solution.
If anyone could share some ideas with me or has a useful similar vi, I would be very thankful!
Thank you so much!
Solved! Go to Solution.
07-16-2014 09:57 AM
Hi MG,
when you are new to LabVIEW you should take the beginner courses offered by NI.com!
- Indexing arbitrary elements is done with IndexArray
- boolean logic is done using boolean logic functions…
- there's a palette full of comparison functions!
- "i" and "j" should be stored in shift registers of the loops
- To "define the logic" you need to explain the function save()…
07-16-2014 11:01 AM
Hi GerdW,
thank you for anwering me. Actually, I did the basic courses of NI.com, nevertheless I am stuck with this code. Sorry if my question is too naive.
My main problem is how to scan the array using indexes i and j which starting value is not the canonical 0 for a while loop or a for loop.
Which objects would you use to store i and j?
Thanks again!
MG
07-16-2014 11:16 AM
Well you could use the add function, and add 1 to i just like you did in your text version.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
07-16-2014 11:24 AM
07-17-2014 01:54 AM
Thank you Hoovahh and GerdW for helping me!!
Your hint allowedme to go on.
My mistake was that I kept trying using the index of the while/for loop as index of the array.
I am a beginner and I still have a lot to learn. Some things you can learn by the course, some by making mistakes, some from more experienced users like you are.
Thank you!
MG
07-17-2014 07:41 AM
@MG70 wrote:
Thank you Hoovahh and GerdW for helping me!!
No problem. In the spirit of teaching I'd like to teach you another trick on the forums. The large majority of us work on these forums for free, and the recognition we get partialy comes from the number of posts we are able to answer, and the number of kudos we get for helping others. So feel free to give kudos to those that help you, and mark topics solved by a post that solves your question.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord