LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert a string into a 1D array of cluster of 2 elements

Solved!
Go to solution

Hello, 

 

I'm working on a project, and I am stuck close to the finish line. I am having trouble finding a proper way to convert a string into 1D array of cluster of 2 elements. More exactly, I am trying to convert the ''Valori incarcate'' into the same type of data as the local variable ''LATURI''. I will attach a picture of the part of the block diagram that I am talking about and the VI.

 

English is not my first language, so I hope that I managed to get the message across.

 

If someone can help or point me in the right direction, it would be greatly appreciated.

 

 

Download All
0 Kudos
Message 1 of 4
(2,269 Views)

It looks like you already have part of the next function there, "Spreadsheet string to array", but it's not wired up.

 

Without knowing the contents of the "date.txt" file it's not possible to know for sure what you need to put to make that work, if it will actually work.

 

Does "date.txt" contain a lot of lines of text, with each line being 2 numbers?  If so, what is between the two numbers?

 

You will need to fill in the following to make the "Spreadsheet string to array" work:

  • A format specifier to match the number format in the file
    • "%f" will probably work, but I can't be sure without knowing what's in the file
  • A separator
    • Default is "Tab"
    • If the numbers in the file are separated by something else (a space, a comma, etc.) then you will need to put whatever that is here instead

Once you get that taken care of, you should get a 2D array of doubles out, which you can then run into a FOR loop and put the two date elements from each line of the file into a cluster, and output that into your LATURI variable.

Message 2 of 4
(2,246 Views)
Solution
Accepted by topic author dave9999

Hi Dave,

 

for code readability I also added the default constant for the string conversion functions:

In the end you just need to learn how to handle spreadsheet string data…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 4
(2,242 Views)

Thank you very much. It worked.

0 Kudos
Message 4 of 4
(2,178 Views)