10-26-2013 01:41 AM
Now it means everytime the Data you are getting is the same.
its not the problem of For loop , but your algorithm
what you are trying to do ??????
You can check your 'encrypt XETA' subvi why everytime the values generated are same ( unless you are not expecting the same values )
10-26-2013 01:48 AM
It is not the encrypt vi. already used shift registers to check. I am getting the previous value.
10-26-2013 01:59 AM
@kulsman wrote:
I am really new to programing in labview (started on Monday). I have been following the labview toturials online and in NI website, but I not been able to solve it.
Edit: all of the values in the array are the same.....
Of course all your values are the same, because you are always reading the same file (that operation probably belongs before the loop because the outcome will not change between iterations!) and are indexing out the same elements (with indices 2 and 3). Note that you are wiring from the inside of N, which simply returns "2" in your case, irrespective of the iteration number. If you want to index out locations that depend on the iteration number, you need to tap into the [i] terminal, not "N".
In any case, note that "index array" is resizeable, so you only need one instance to get two elements. Simplify!!
It is really impossible to debug your code from a picture, because there is simply not enough information. For example what is the datatype of the blue diagram constant wire to the file read? What is in the other case of the case structure, and what value is the boolean when you run the program? Why is Key(HEX) inside the loop? Most likely the value is constant for the duration of the loop, thus it belong outside the loop.
For the given reason, you should always attach your VI. Even if the subVIs are missing, it can give us much richer information to debug the situation.
10-26-2013 02:01 AM
can you attach small section of code ?
Because it is not possible that if you are getting different values at every iteration of For loop from 'Encrypt XETA' vi then you are not able to get it outside the For loop with indexing enabled.
Or directly index the two outputs of 'Encrypt XETA' vi and check what do you get
10-26-2013 02:09 AM - edited 10-26-2013 02:14 AM
Of course all your values are the same, because you are always reading the same file (that operation probably belongs before the loop because the outcome will not change between iterations!) and are indexing out the same elements (with indices 2 and 3). Note that you are wiring from the inside of N, which simply returns "2" in your case, irrespective of the iteration number. If you want to index out locations that depend on the iteration number, you need to tap into the [i] terminal, not "N"
Christian, No excuses , I didnt pay a lot attention while replying.
Sorry about that
Yeah, I thought it was just a demo
10-26-2013 02:11 AM
I am not sure, if this will help here is my vi. It is saved in labview 2013
10-26-2013 02:20 AM
You didnt attach Subvi and sample sound file.
Still it is very clear form altenbach's explanation why you are getting same values every time
10-26-2013 02:27 AM
The file I am read in is a wav file with roughly ~5000 data points. For the purpose of simplicity, I choose a C value of 2. It does not matter what C value I choose the array does not build properly. I just need to find a way to build out the array.
10-26-2013 02:44 AM
@kulsman wrote:
The file I am read in is a wav file with roughly ~5000 data points. For the purpose of simplicity, I choose a C value of 2. It does not matter what C value I choose the array does not build properly. I just need to find a way to build out the array.
You are not listening. Your loop does exactly the same thing with every iteration, because nothing depends in the iteration value i.
What is "C"???
Here is code that might bring you a little bit closer to a solution. (there are still quite a few unanswered questions and problems, but this might get you started)
10-26-2013 02:46 AM
you are not getting the point
In the pic you have attached you are reading the file with 5000 samples so every iteration of For loop the array is same containing 5000 elements( because you are reading the same file in loop)
Now you are interested in a fixed indexed values ( beacuse the values you are wiring to index array are constant ).
{ at this point i think you need different elements from the array every time}
So original array will always give you the same values.
and build array will act accordingly..........