ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

convert string into a 1d array of strings

Solved!
Go to solution

This is the output I have:

Battery Output.png

I want to take that string, and convert it to a 1d array of strings, so I can access each line, with index array.

I tried this:

Code - Battery Output.png

But the output is a double, and I need it to be a  string.

How can I fix this?

I will leave my code, maybe someone can take a look at it.

thanks.

0 Kudos
Message 1 of 34
(13,451 Views)

In the "Spreasheet string to array", wire a empty 1D array of string diagram constant to the type input on the lower left and use a %s format. The output will be a 1D array of strings.

 

Your code looks extremely convoluted. Can you create an indicator after the sytem exec, then run your Vi until intcontains data. Now stop the VI and right-click that indciator and "create constant". Save under a new name and attach it once more. Now we have typical data to play with. 

0 Kudos
Message 2 of 34
(13,443 Views)
Can I convert this string into a 2d array after the ":"?
0 Kudos
Message 3 of 34
(13,428 Views)

@Nando88 wrote:
Can I convert this string into a 2d array after the ":"?

Yes, of course. However, you need to explain what you atually mean by all that. Where is a "."?

 

We are not clairvoyant! Why don't you do what I suggested above first? Then tell us what kind of output you expect.

0 Kudos
Message 4 of 34
(13,421 Views)
I want to change column after ":" in the string.
0 Kudos
Message 5 of 34
(13,410 Views)

@Nando88 wrote:
I want to change column after ":" in the string.

I still don't quite understand what you mean. You can use "." as column delimiter and newline will be autimatically the row delimiter once you wire a 2D array of string.

 

It would really make things much more clear if you would actually do what I requested two posts ago. Is there anything preventing you from doing that?

 

0 Kudos
Message 6 of 34
(13,392 Views)
I want to change column, to create a 2×2 array of strings after a colon is found on the string.
I want to change line and column after a colon is found in the string, in order to create a 2×2 array.
Thanks, and sorry for not making myself clear.
0 Kudos
Message 7 of 34
(13,333 Views)
It just a column change after the colon and a line change after the end of the item being deacribed. For example: if its battery lercsntage, it should put the heading (battery prrcentage) on the first column and the actual percentage on the second column, and then change line, and so on.
Thanks.
0 Kudos
Message 8 of 34
(13,322 Views)

@Nando88 wrote:
It just a column change after the colon and a line change after the end of the item being deacribed.

Then you really should have taken Altenbach's advice by using the Spreadsheet String To Array.  I did some more messing around with the data to turn those tabs into spaces first.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 9 of 34
(13,309 Views)

I can print it just fine, but in the array, it doesn't show the complete info, just the headings.

How can I fix this?

Thanks.

0 Kudos
Message 10 of 34
(13,291 Views)