LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re: repeatability of words in an array

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 11 of 24
(566 Views)

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.

0 Kudos
Message 12 of 24
(548 Views)

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?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 13 of 24
(536 Views)

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.

0 Kudos
Message 14 of 24
(530 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 15 of 24
(514 Views)

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.

qureshi000_0-1725614909295.pngqureshi000_1-1725614925287.png

 

 

0 Kudos
Message 16 of 24
(507 Views)

Hi, this is my idea, you can try it.

IDMAN_0-1725615497757.png

IDMAN_1-1725615508859.png

 

 

0 Kudos
Message 17 of 24
(496 Views)

By using search 1D array duplicate values will not save and I want to save them as well.

0 Kudos
Message 18 of 24
(492 Views)

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…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 19 of 24
(470 Views)

@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.

0 Kudos
Message 20 of 24
(447 Views)