LabVIEW Digest Programming Challenges

キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

LabVIEW Digest Challenge 1

I've sent my entry. Looking forward to results スマイリー ハッピー.

0 件の賞賛
メッセージ11/20
7,730件の閲覧回数

Thanks! I have just received it

 

We've received a huge range of different solutions so I look forward to sharing them with everyone next week.

 

Charlotte

0 件の賞賛
メッセージ12/20
7,723件の閲覧回数

Hi Everyone, 

 

I picked a correct solution at random we now have a winner I've attached the winning code entry below and there's a free training voucher on its way to the programmer now! Congratulations!

Winning Entry.PNG

 

 

A lot of people had a solution like this so I recommend checking out this link on auto-indexing for loops as that makes life a lot easier and stops the while loop within a while loop which can be easy to get stuck in!

 

 

Thank you to everyone who entered the competition! We will be running it again in the next few months so keep an eye out for the LabVIEW Digest. We had a lot of entries and despite a relatively simple problem, we had a huge number of different ways of solving it! I've posted below some of the other variations as there's always things to learn from other people's code.

 

 

 

0 件の賞賛
メッセージ13/20
7,665件の閲覧回数

Search and replace array elements first, then sum - not quite right, will only find the first 10 value, not the second. Issue fixed below.

 

Case Structure.PNG

 

A beautifully simple solution:

 

Simplicity.PNG

 

Using auto indexing and for loops:

 

For loop.PNG

We even had an object-oriented solution from Thoric which I have attached:

 

OOP.PNG

 

 

Which solution do you like best?

 

 

 

メッセージ14/20
7,662件の閲覧回数

I don't want to be that guy, but I will be! There is a small bug in solution 1 - try putting in two '10's, it will pick the first but not the latter. It's an issue I've put in code before with the 1D search. It just needs a little more code to work fully though - the concept is good.

 

I like the simple solution - I had a similar concept in mind. It feels more efficient than looping but I'm not sure if it is!

James Mc
========
Ask me about Rust & NI Hardware
My writings are at https://www.wiresmithtech.com/devs/
0 件の賞賛
メッセージ15/20
7,651件の閲覧回数

Oh good spot! That will teach me to only thoroughly check the winner. I thought I had checked them all but obviously not. I made a quick alternative solution based on that code to fix that bug. It's a bit more convoluted now though, perhaps there's a simpler way but still using the same idea of searching and replacing.

 

Search.PNG

0 件の賞賛
メッセージ16/20
7,635件の閲覧回数

@CharlotteN wrote:

 

 

We even had an object-oriented solution from Thoric which I have attached:

 

OOP.PNG

 

 

 


The OO approach is extensible. The parent class for storing numbers can be overridden with any child class for exhibiting special behaviour when adding numbers. Also, the method for "sum" can be extended with new methods, such as "product" or "factorial" etc., without much effort.

For this problem it's clearly way over the top, but perhaps good reading for anyone interested in learning about OOP in LabVIEW.

 

I've enjoyed the challenge Charlotte, looking forward to the next one!

Thoric (CLA, CLED, CTD and LabVIEW Champion)


メッセージ17/20
7,537件の閲覧回数

Hi

Can you please announce the winner of Challenge 1, and then post next challenge?

Happy to Wire
0 件の賞賛
メッセージ18/20
7,517件の閲覧回数

Hi Sankar06, 

 

The winner was announced a few weeks ago and the winning solution can be seen above.

 

We will be running the challenge roughly every 3 months when we release the LabVIEW Digest Newsletter. If you're interested in hearing about the next challenge immediately I recommend looking at your email settings and selecting to receive the LabVIEW Digest. If not, keep checking back here for Challenge 2. You can expect it around late May, early June. 

 

Thanks,

 

Charlotte

メッセージ19/20
7,514件の閲覧回数

This my solution:

Sum of Array (snippet).png

HOB Consultores S.A.
Área de Investigación, Desarrollo e Innovación Tecnológica
0 件の賞賛
メッセージ20/20
6,478件の閲覧回数