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

Adding string to array

¡Resuelto!
Ir a solución

Hello,

 

I am facing issue in write a string into array. I am reading a text file using Read from Text File.vi in a For loop and matching a string match pattern. VI which gives me desired string. Now the string which I have got at output, I am not able to put this string into array. I have tried doing the auto index function of for loop for creating the array. Please suggest a way to build the array.

0 kudos
Mensaje 1 de 8
2.364 Vistas

Your task is really easy. Please post your code possibly in LabVIEW <= 2021 (maybe also a snippet or picture) to let us see where's the error.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Mensaje 2 de 8
2.357 Vistas

Hi Swami,

 


@Rohan1612 wrote:

I have tried doing the auto index function of for loop for creating the array. Please suggest a way to build the array.


When you want to "build an array" you should consider using the BuildArray function!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 kudos
Mensaje 3 de 8
2.352 Vistas

ReadTextFile.PNG

 Please see the snippet for the code.

Thanks in advance.

0 kudos
Mensaje 4 de 8
2.331 Vistas
Solución
Aceptado por Rohan1612

When Match Pattern function fails to find a match, a -1 is issued in offset past match. Use this value to filter the output.

Unless your LabVIEW version is rather old, you may right click on the output tunnel making it conditional, then wire offset past match  >= 0 the conditional terminal:

match.png

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Mensaje 5 de 8
2.318 Vistas

Hi Rohan,

 


@Rohan1612 wrote:

Please see the snippet for the code.


This is not a snippet, it's just an image of your code. Snippets are special to LabVIEW: read the LabVIEW help to learn about them!

 

You already create an array of strings, so I don't know why you claim "you are not able to put the string into array"!?

Best regards,
GerdW


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

Thanks for the solution. I could build an array.

0 kudos
Mensaje 7 de 8
2.276 Vistas

Thanks GredW for the input on Snippets. I will surely look into it.

0 kudos
Mensaje 8 de 8
2.275 Vistas