LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Replace Array element based on certain conditions

Solved!
Go to solution

Hello All,

 

Please help me if anyone have nice idea.

 

I want to replace Array elements based on certain conditions.

As per attached Sample,

I have fixed character Array & Some Random values with Array Size.

Here, I need to check Random char with fixed Array. If char is not matching then I need to replace that index value with “NaN”. Once it is matching for one time then next time I need to display Run time value for that particular index.

Munna
0 Kudos
Message 1 of 11
(3,548 Views)

Maybe i misunderstood, but it can give you some ideas.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 11
(3,517 Views)

Maybe i misunderstood, but it can give you some ideas.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Download All
0 Kudos
Message 3 of 11
(3,517 Views)

Dear Yamaeda,

 

Thanks for your reply.

 

your attached VI is not mathching with my requirement. If 1st time Index is matching then next time we should not display NaN (eventhough its not mathching for next time). I have to display NaN until that index is not matching.

after Matching I need to display Runtime Value....

 

 

Munna
0 Kudos
Message 4 of 11
(3,490 Views)

Ok, so your program is working as it should? Then what's the question? 🙂

What problem are you trying to solve?

 

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 5 of 11
(3,484 Views)

Sorry. I'm thinking to minimize my code.

 

Just waiting for better solution.

Munna
0 Kudos
Message 6 of 11
(3,477 Views)
Solution
Accepted by topic author Munna232

Yes, you have way too much code for such a simple problem. Also, your random character generator is flawed, because A and Z will only occur at half the probability of the other characters.

 

Here's a quick draft how it could be done with less code (LV 2012). Modify as needed. I am sure more simplifications are possible....

 

 

Download All
0 Kudos
Message 7 of 11
(3,467 Views)

Dear Altenbach,

 

Thanks for your nice idea.

 

I have made minor changes to your code. Because sometimes i need to check Same character 2-3 times from Fixed array.

I think, once all index values are matching then no need to check.

 

NaN3.png

 

 

 

Munna
0 Kudos
Message 8 of 11
(3,447 Views)

You can just do a "AND array elements" on the boolean array for the outer case structure. No need to convert, sum, compare sizes, etc.

0 Kudos
Message 9 of 11
(3,432 Views)

Yes.. Thank you altenbach 🙂

Munna
0 Kudos
Message 10 of 11
(3,430 Views)