search for a value in an array (s7)

userxyz

Member
Join Date
May 2002
Location
any
Posts
2,768
when you have an array of 100 DINT's...

And you enter in a wincc flex I/O field a DINT value to search for.

How can you do that and know the arraynumber of where the value is located ?
 
Combo said:
when you have an array of 100 DINT's...

And you enter in a wincc flex I/O field a DINT value to search for.

How can you do that and know the arraynumber of where the value is located ?


Ik zou zo zeggen vergelijk op flank of het getal is ingegeven gelijk is aan het vorige vanaf de moment dat het niet gelijk is, start loop door u array, en vergelijk iedere loop of het geen ge ingegeven hebt gelijk is aan het gene in de array.
Tel het aantal loops, en as ge iets tegen komt dat gelijk is weet ge ok de plaats van de DINT in u array alleen vraag ik me af wat ge gaat doen als er meer getallen in u array staan die gelijk zijn. Of gade enkel zoeken achter het eerste getal dat gelijk is?
Is maar een oplossing vrij simpel maar zullen er waarschijnelijk nog vele andere zijn
 
babel fish leaves me none the wiser :)

I would say to agreement on flank this way if the number has been motivated equal is to previous as from the moment that it is not equal, starts course by you array, and agreement every course or it to none ge have motivated equal are to gene in the array. Tel the number of loops, and ash ge something against comes that equal is weet ge okay the place of the DINT in you array only question I me finished what ge will do if numbers there more in you array stand be that equal. Or only zoeken gade behind the first number which is equal? Is but a solution rather simple but waarschijnelijk other still a lot of will be
 
L D[AR2 said:
babel fish leaves me none the wiser :)

Oeps to fast

I said: This is an solution but there will probaby be even more then only this

Ok

- Put a number in the Wincc. When the number changes detect a flank on that change
- Start a loop when the number changes through the Array/DB
- Compare the number that is on the screen with the number in the array
- Count the loops
- once the number in Array/DB is the same as on the screen you can figure out the DBD value of that Array/DB
- but, yes there is always a but :)
- what happens when there are 2 numbers the same in the array?
- Does he need to check all the numbers in the array of is it sufficient when he finds the first number that is equal
-When only the first is ok than you can jump out the loop since you know the position
- when you need all the positions i think you should make a Array/db next to it to place all the positions in


Probably there are more/better solutions for this but this is 1
 

Similar Topics

Hi I new to ST programming and I am trying to figure out how I can search an array for an value (3). I want TEST to go high if eg trayArray[6] =...
Replies
10
Views
2,437
Hello all, Some of you may be familiar with the RAM searching program for Windows computers, Cheat Engine. You can search RAM directly for...
Replies
0
Views
739
Anyone knows how to search in a file... For example: I want to find empty spaces in a DB by searching after zero values... Can I do it...
Replies
6
Views
2,774
Searching edit zones within all routines and other criteria still says no results found, yet I still have the "edits present" indicator at the...
Replies
6
Views
255
I have an InTouch HMI that has PID parameters. I need to find what the PID values were in the past. I have backups from the past, but none...
Replies
48
Views
5,560
Back
Top Bottom