09-05-2024 02:30 AM - edited 09-05-2024 02:30 AM
Hi qureshi,
@qureshi000 wrote:
Last amplitude as shown in attached picture.
See this approach:
I used variant attributes as I most often work with older LabVIEW versions, you may use maps/sets instead.
I leave the counting of the frequency items up to you…
09-06-2024 12:39 AM
I have an array named Array A whose data I want to save in another array named Real Array. In real time elements of Array A will change like initially it has values 100M, 101M and 106M, second time it has no value which means empty array, third time it has values 101M, 102M and 108M. So, output of Real Array should be 100M, 101M, 106M, 101M, 102M and 108M. The code is inside the while loop. So, I can change the values of Array A while code is running. If I change any value of Array A like 100M to 107M then in Real Array 100M should not change to 107M but 100M should remain at its place and 107M should be saved it new index of Real Array (100M, 101M, 106M, 101M, 102M, 108M and 107M). How can I achieve this kindly guide me.
In my current code, due to while loop data is keep saving in Real Array until the code is running. My code is attached.
09-06-2024 12:51 AM - edited 09-06-2024 12:52 AM
Hi qureshi,
@qureshi000 wrote:
How can I achieve this kindly guide me.
Yesterday I showed you some code (image) that would help you in this problem, and I also explicitely mentioned maps and sets.
Why do you need to start a new thread today asking basically the very same question?
Did you try my code suggestions?
Did you try understand how variant attributes work?
Did you even learn about using maps and sets?
09-06-2024 01:09 AM
It is a different question from the query asked yesterday. In this case I want to save all the incoming data from Array A in Real Array and I do not want last value and this data should remain save even if I stop the code. If any element repeat itself it should be saved as it as in next index.
You can again read my question.
I have an array named Array A whose data I want to save in another array named Real Array. In real time elements of Array A will change like initially it has values 100M, 101M and 106M, second time it has no value which means empty array, third time it has values 101M, 102M,108M and so on. So, output of Real Array should be 100M, 101M, 106M, 101M, 102M and 108M. The code is inside the while loop. So, I can change the values of Array A while code is running. If I change any value of Array A like 100M to 107M then in Real Array 100M should not change to 107M but 100M should remain at its place and 107M should be saved it new index of Real Array (100M, 101M, 106M, 101M, 102M, 108M and 107M). How can I achieve this kindly guide me.
In my current code, due to while loop data is keep saving in Real Array until the code is running.
09-06-2024 01:30 AM - edited 09-06-2024 01:30 AM
Hi qureshi,
@qureshi000 wrote:
It is a different question from the query asked yesterday. In this case I want to save all the incoming data from Array A in Real Array…
You can again read my question.
I did now.
So your question now is "How do I build arrayB with elements from arrayA in a loop?" ???
This is very basic LabVIEW stuff: use a shift register and BuildArray to build an array…
@qureshi000 wrote:
this data should remain save even if I stop the code.
You need to save your data to a file BEFORE you stop the code…
09-06-2024 04:17 AM - edited 09-06-2024 04:28 AM
I do not want to save data in any file. I want to save data of Array A in Array B directly. If any element repeat itself it should be saved as it as in next index. This data should remain save even if I stop the code. Currently, my code is saving data of Array A in Array B but if I change any element of Array A it will also be change in Array B. I do not want that I want to save any change in Array A to be save at next index of Array B.
09-06-2024 04:38 AM
Hi, this is my idea, you can try it.
09-06-2024 04:42 AM
By using search 1D array duplicate values will not save and I want to save them as well.
09-06-2024 05:36 AM - edited 09-06-2024 05:39 AM
Hi qureshi,
@qureshi000 wrote:
I want to save data of Array A in Array B directly.
Then why don't you do this?
You don't need a FOR loop to append arrayA to arrayB:
@qureshi000 wrote:
I do not want to save data in any file.
You wrote you want to save the data even when the VI stops! (The exact wording was "this data should remain save even if I stop the code".)
Your requirement usually implies you want to save your data to a file…
09-06-2024 10:25 AM
@qureshi000 wrote:
It is a different question from the query asked yesterday. In this case I want to save all the incoming data from Array A in Real Array and I do not want last value and this data should remain save even if I stop the code. If any element repeat itself it should be saved as it as in next index.
You can again read my question.
I have an array named Array A whose data I want to save in another array named Real Array. In real time elements of Array A will change like initially it has values 100M, 101M and 106M, second time it has no value which means empty array, third time it has values 101M, 102M,108M and so on. So, output of Real Array should be 100M, 101M, 106M, 101M, 102M and 108M. The code is inside the while loop. So, I can change the values of Array A while code is running. If I change any value of Array A like 100M to 107M then in Real Array 100M should not change to 107M but 100M should remain at its place and 107M should be saved it new index of Real Array (100M, 101M, 106M, 101M, 102M, 108M and 107M). How can I achieve this kindly guide me.
In my current code, due to while loop data is keep saving in Real Array until the code is running.
So your loop only needs to spin if the input array changes, and not millions of times per second, right? What makes the input array change? (data read from an instrument? user input?) Since there is likely a nonzero probability that successive inputs are the same, maybe you want an button to trigger appending and use an event structure. And no, you don't need pyramids of loops. All you need is an outer while loop.
You should also tune your terminology. The word "save" should be reserved for file IO. None of your data is "saved", it is just kept in a shift register wire (and indicator) until you close the VI.