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

How make for loop with min max value ina Array

Xd now you tell me is min max function, thanxxxx
0 件の賞賛
メッセージ41/55
2,538件の閲覧回数

@crisdragon wrote:
Xd now you tell me is min max function, thanxxxx

Well, I assume that one is allowed, just not "Array Min&Max". Who knows?  😄

 

Make sure to show us the final code so we can comment.

0 件の賞賛
メッセージ42/55
2,531件の閲覧回数

@altenbach wrote:

@crisdragon wrote:
Xd now you tell me is min max function, thanxxxx

Well, I assume that one is allowed, just not "Array Min&Max". Who knows?  😄

 

Make sure to show us the final code so we can comment.


I had assumed that one was NOT allowed.  That the problem was taking Array Min & Max and duplicating with the most basic of LabVIEW functions.  Min/Max is great in that it actually eliminates a comparison and a select function.  Or comparison and a case structure.

0 件の賞賛
メッセージ43/55
2,512件の閲覧回数

Almost done, i think is last problem, why i cant ad wire from max in place after index array - the wire connects more than one data source 😕

0 件の賞賛
メッセージ44/55
2,506件の閲覧回数

Your code is not comparing the CURRENT Max or the CURRENT Min.  Your C based code isn't even accurate.  Think of shift registers as Integers initialized in separate functions.  In C based code, in order to keep track of who the Max and Min are, you would set up Ints Max and Min, yes?  Then, when a value has been determined to be less than or greater than either, the corresponding values are updated.  Think of a shift register like that.  That's why everyone has been saying 2 shift registers.  Your indicators are not the same as integers.  They are value displays.  They do nothing else but display whatever the current value is, and your code is updating them incorrectly.  Someone mentioned using Local Variables... but no.  Data flow goes from left to right.  Once you've gone as far right as you can go, what has to happen?  You have to start from the left again.  Which is why loops are circles.  Then you start over left to right.  Where does the Max value come from?  Who is the max value being compared to?  Same with the Min?  Ask these questions when programming.

 

0 件の賞賛
メッセージ45/55
2,470件の閲覧回数

Ok its done, but i think this looks not good. Anyone can rate this?

0 件の賞賛
メッセージ46/55
2,467件の閲覧回数

What's the task again?  To simply find the single max and min elements of an array or to put them in order?

0 件の賞賛
メッセージ47/55
2,463件の閲覧回数

@crisdragon wrote:

Ok its done, but i think this looks not good. Anyone can rate this?


You are ignoring the first element. Min and Max should be scalars, not arrays. indicators belong after the loop. No need to update them every nanosecond with uninteresting intermediary values.

 

Here is some simple code to get the max, see if you can expand it for the full problem 😉

 

 

メッセージ48/55
2,450件の閲覧回数

Your code is awesome but i dont understand -infinity. 

0 件の賞賛
メッセージ49/55
2,447件の閲覧回数

@crisdragon wrote:

Simply find max and min without using MIN & MAX Array. But this work good, what i should change?


Define "works"! Define "this"! (it has been a long thread!)

 

  • Does it work for any size input array? (e.g. 1000000 elements)
  • Does it work if all input values are negative?
  • Does it work if the input array is empty?
  • Does it work if the input contains elements that are NaN?

If you want us to verify the code, attach the actual VI!

0 件の賞賛
メッセージ50/55
2,435件の閲覧回数