cancelar
Mostrando los resultados de 
Buscar en lugar de 
Quiere decir: 

problem with an array

HI!

I hope somebody can help me. I have an array with zeros in it! in my programm i will search all zeros and replace them with new data from the calculation inside of the while-loop.

Example:

Array with zeros:

1
0
2
0
3
0
4

calculation:

first zero with index 1 : will be replaced with the number from the following calculation --> (1+2)/2


TNKS

PETER
Labview 7.1 on Windows 2000
0 kudos
Mensaje 1 de 6
3.115 Vistas
Hello peda,

maybe this will help you. You have to do some error checking: this vi may behave erranous if the first and last element of the array are zero.
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 kudos
Mensaje 2 de 6
3.105 Vistas
thanks for your help! in the meantime, i solved this problem.

TNKS

Peda

greets from austria
Labview 7.1 on Windows 2000
0 kudos
Mensaje 3 de 6
3.093 Vistas
Hello peda,

if array2.vi is your solution, then you will have some problems 🙂

Please have a look into my example:
- I changed your "Delete Element"/"Insert element"-pair to "Replace element". This way you don't build up new arrays in every iteration of the loop. This will be handy when you have to work with big arrays. Because of this I also used a shift register.

- I changed the loop stop condition. At the moment you try to check every element. But if your array contains only a small percentage of zeros, then your loop will run much longer than needed. In my example I stopped the loop, when there is no zero in the array.

- Also to mention: to search for zero is ok, because zero has it's own code in double (IEEE) representation. But if you change this (lets say you search for 3.14159...) then there could be problems because of the limited precision of the number format. There are many threads on this...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 kudos
Mensaje 4 de 6
3.088 Vistas
HI!

But this programm only replaces one zero and the other one*s are not corrected!

Then you have you have to go to the frontpanel and to write the new number in to the array....

I work with big array*s and i my program i want to delete all zeros. But when i ran the programm there are zeros anywhere.
The program don*t delete and replaces all zeros.

Regards,

peter
Labview 7.1 on Windows 2000
0 kudos
Mensaje 5 de 6
3.069 Vistas
Hello peda,

sorry my fault. The loop stop condition was set wrong...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 kudos
Mensaje 6 de 6
3.063 Vistas