Discussions au sujet de NI LabVIEW

annuler
Affichage des résultats de 
Rechercher plutôt 
Vouliez-vous dire : 

Condition avec tableau 2D

Résolu !
Accéder à la solution

Bonjour, j'aurais besoin d'aide sur un projet sur lequel je commence à bloquer un peu.

 

J'effectue l'acquisition de trames que je reçois sous forme de tableau 2D d'une taille (10.000 lignes,12 colonnes) quelque soit le nombre d'acquisition (le tableau se remplira de 0 à la fin si le nombre d'acquisition est inférieur à 10.000). Je vous joints au post un exemple d'extraction. La dernière valeur reçue s'ajoute en début de tableau.

 

- J'aimerais pouvoir arrêter ma boucle While lorsque la dernière ligne est différente de [0 0 0 0 0 0 0 0 0 0 0 0]; je n'arrive pas à manipuler les comparateur avec des tableau de booléen, je ne sais pas si c'est possible ou non de cette manière.

 

- J'aimerais aussi pouvoir trouver l'indice d'une ligne sur laquelle se trouve en colonne 4, 5, 6 et 7 deux valeurs particulière, exemple 0 6 0 128:

 

Tableau.jpg

Merci par avance pour le temps passé sur ce sujet  😀

 

0 Compliments
Message 1 sur 13
1 916 Visites

Not sure how well google translate worked on your post.

 

-it is not clear how many elements are replaced with each iteration (one column? A 2D array with a fixed number of rows? A 2D array of variable row length?)

-you can keep count (simple integer in a shift regsiter) how many values are added and compare with the final size.

 

To find the existence and position(s) of a given subset of elements, you need to iterate over all possible subsets. Are these integers?

 

Please attach a simplified version of your VI.

0 Compliments
Message 2 sur 13
1 890 Visites

On ne sait pas comment est implémentée ta boucle while alors difficile de t'aider. Poste ton code.

 

note: comme tu connais la taille de ton tableau 2d pourquoi n'utilises-tu pas une boucle FOR?

 

Ben64

0 Compliments
Message 3 sur 13
1 875 Visites

@ben64 wrote:

note: comme tu connais la taille de ton tableau 2d pourquoi n'utilises-tu pas une boucle FOR?

 


The number of iterations is only known if a fixed number of elements is added with each iteration. Thus my question above. We clearly need more info.

0 Compliments
Message 4 sur 13
1 868 Visites

It says that he always receive a 10 000 X 12 array whatever the number of acquisition, if the acquisition is less than 10 000 lines it is filled by zeros. But clearly there's a lot of missing info.

 

Ben64

0 Compliments
Message 5 sur 13
1 864 Visites

It wasn't entirely clear. My understanding was that the final size is 10k rows, and the array is initialized with zero, then filled with real data as it arrives. The problem was to determine once all rows have been filled, i.e. when the last row is no longer all zeroes. Hard to tell without seeing code....

0 Compliments
Message 6 sur 13
1 846 Visites

quelque chose comme cela ?

test.png

0 Compliments
Message 7 sur 13
1 840 Visites
Solution
Accepté par l'auteur du sujet Michel_Dupuy

@thib_fr wrote:

quelque chose comme cela ?

test.png


This is incorrect for the general case because DBL numbers can be negative and your loop would stop of a row is [-1, 1, 0, 0...] for example. Are all values guaranteed to be positive integers? Values seem to be U8 range, so it is not clear why the file wastes all these bits for decimal points and triple decimal zeroes. We all know that equal comparisons should never be done with floating point numbers (e.g. DBL), so I recommend using an integer datatype.

 

There is also actually more than one row (eight!) that matches the pattern, so we need to keep the entire array of solutions.

 

Here's a slight modification that is probably safer (of course it is not clear if this is the solution).

(The ""last index" is the index of the row with all zeroes)

 

altenbach_1-1599898881772.png

 

 

 

Message 8 sur 13
1 833 Visites

Sorry for the language concern. My first message was:

 

Hello everyone, please I need your help on a project on which I can no longer move forward.

 

I am acquiring frames which are stored in a 2D array with a fixed size of (10.000 rows, 12 columns), whatever the number of acquisitions (the array will be filled with rows of 0 at the end if the number of acquisitions is less than 10.000). I attached to this post an extraction example. The first value is stored at the end of the array and the last one at the beginning.

  • I would like to stop the While loop when the last row (the 9999th) is different than [0 0 0 0 0 0 0 0 0 0 0 0]; I don’t really know how to manipulate comparison operators whith boolean arrays.
  • I would also like to find the index(es) of the row(s) on which are present specific values on column 4 / 5 / 6 and 7 ; for example 0 6 0 128 on the picture below :

Michel_Dupuy_0-1599905456772.jpeg

 

Reply to Altenbach first reply:

Thanks for replying to the post, and sorry for the language concern I should have written it in English.

 

  • Each frame corresponds to a row; so, 1 row is replaced on each iteration. The 2D array is fixed in a subVI corresponding to a device library that I cannot modify. Each value represents an 8 bits unsigned integer from 0 to 255.

I'll will probably devide the two tasks on two subVIs. Here are the extracts of how I am trying to implement the codse (not comfortable with array handling), there are probably more than one correction on those extracts:

 

1/ Stopping the while loop:

image.png

2/ Finding the indexes:

 

image.png

 

Thanks again everyone for your solutions and for the time spent on this post.

0 Compliments
Message 9 sur 13
1 825 Visites

Thanks for this solution @ , so the  "logical AND for array" is required to handle boolean array.

 

Am I right if I compare only the last row by this way to stop the while loop:

image.png

 

And for the matching rows:

 

image.png

 

Thanks again

 

 

0 Compliments
Message 10 sur 13
1 816 Visites