LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing elements of array with previous ones and insert index of elements where v[i+1]<v[i] in another array

Solved!
Go to solution

Hi ptavernise,

 

I cannot understand where is the error.

Well, LabVIEW shows you exactly where the error is located. It even describes the error in the context help when you move the mouse to the location…

 

Problems I see in your VI:

- you want to compare with several elements, but in your shift register you only read one value from previous iteration…

- you want to compare several elements, but you compare with the whole waveform at once…

- again (as has been said before) you store the index in the shift register and use this index to compare with values of elements…

 

Please learn the LabVIEW basics like autoindexing and using shift registers…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 11 of 17
(1,392 Views)

sorry,

but i'm not able to find solutions, can you show me how to do please?

0 Kudos
Message 12 of 17
(1,384 Views)
Solution
Accepted by topic author ptavernise2345

Hi ptavernise,

 

your really should start to learn LabVIEW. And drawing an algorithm on a sheet of paper first might help too…

 

Spoiler
This works according to your description:
check.pngIt's not perfect (aka free of errors). try to understand it by reading the help for all functions!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 13 of 17
(1,368 Views)

The block with 5 where is located(queue)?

0 Kudos
Message 14 of 17
(1,360 Views)

As i pointed earlier start reading basics, then you will get most of the things.
-The VI which you asked for: https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/vi-lib/ptbypt/other-functions-llb/data-que...

Thanks
uday
0 Kudos
Message 15 of 17
(1,347 Views)

Hi,

as i stated previously i'm new to labview. Now i need to create a VI which receiving an array determins the indexes of prime numbers and insert these indexes in another array and if number is not prime insert 0 in array output.

Example 

Array input=[1,2,25,3,7,5,7,36]

Array output=[0,1,0,3,4,5,6,0]

 

Any help would be kindly appreciated

 

Thank you so much

0 Kudos
Message 16 of 17
(1,349 Views)

Hi ptavernise,

 

now it starts to get silly!

You started a new thread for the very same algorithm?

All that has changed is the condition you want to check!

(And well: there is a PrimeFactors function in LabVIEW available…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 17 of 17
(1,335 Views)