le 09-11-2020 11:38 AM
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:
Merci par avance pour le temps passé sur ce sujet 😀
Résolu ! Accéder à la solution.
le 09-11-2020 12:16 PM
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.
09-11-2020 01:00 PM - modifié 09-11-2020 01:23 PM
le 09-11-2020 01:40 PM
@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.
le 09-11-2020 01:48 PM
le 09-11-2020 09:51 PM
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....
le 09-12-2020 01:44 AM
quelque chose comme cela ?
le 09-12-2020 03:23 AM
@thib_fr wrote:
quelque chose comme cela ?
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)
le 09-12-2020 05:25 AM
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.
Reply to Altenbach first reply:
Thanks for replying to the post, and sorry for the language concern I should have written it in English.
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:
2/ Finding the indexes:
Thanks again everyone for your solutions and for the time spent on this post.
le 09-12-2020 06:30 AM
Thanks for this solution @altenbach , 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:
And for the matching rows:
Thanks again