LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

spreadsheet string to array function - what am I doing wrong?

Solved!
Go to solution

I'm trying to utilize a hard coded spreadsheet in the VI below and allow the user to select which row of the value to call out. Trouble is that the program is not able to read the value at any given row and would return a value of "0" no matter the rows selected.Spread sheet to array.png

0 Kudos
Message 1 of 15
(7,749 Views)

You need to change your format specifier from %d to %f.

 

However, you are making this way too complicated.

 

See below.

 

mcduff

snip.png

 

 

 

 

0 Kudos
Message 2 of 15
(7,737 Views)
  • You need to specify the comma delimiter. 
  • You should use a %f format string.  Otherwise values will be rounded. 
  • A 2d array is not necessary.  Wire up a 1D array to the array type input on Spreadsheet String to Array.
aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 3 of 15
(7,736 Views)

@mcduff wrote:

However, you are making this way too complicated.


Depends on where the data is coming from. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 4 of 15
(7,733 Views)

1. Set your delimiter to be a comma (,).  The Spreadsheet String To Array defaults to use a tab.

2. You probably want to use %f as your format, which is for a floating point.  Write now you have %d, which is for an integer.  Therefore the scan currently ends at the period.


GCentral
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 5 of 15
(7,732 Views)

You need to specify the comma delimiter. 

 

Not needed in this case since there is a new line in between values, if it was all one line then yes. Parses correctly in LabVIEW 2017 without comma delimiter.

 

Main Problem %d specifier, not %f (There are other problems as you have noticed.)

 

cheers,

mcduff

0 Kudos
Message 6 of 15
(7,726 Views)

@aputman wrote:

@mcduff wrote:

However, you are making this way too complicated.


Depends on where the data is coming from. 


From the OP

a hard coded spreadsheet

 

Should be able to change that to an array of numbers Smiley Wink

 

mcduff

0 Kudos
Message 7 of 15
(7,723 Views)

@mcduff wrote:

@aputman wrote:

@mcduff wrote:

However, you are making this way too complicated.


Depends on where the data is coming from. 


From the OP

a hard coded spreadsheet

 

Should be able to change that to an array of numbers Smiley Wink

 

mcduff


I understood that statement completely different.  A string is not a "hardcoded spreadsheet".  Smiley Very Happy

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 8 of 15
(7,720 Views)

I have strange interpretations of words, sorry.

 

Hard coded to me meant it was stuck inside the code. (Also previously the OP posted a VI in another thread that had the same/similar VI as the one posted here throughout it. That may be biasing me a bit. They weren't reading from an instrument, file, etc.)

 

cheers,

mcduff

0 Kudos
Message 9 of 15
(7,708 Views)

wow you guys even went through my past questions, that's impressive.

But yes I am trying to in some way hard code the values as so users won't somehow alternate the given values unless purposely doing so.

0 Kudos
Message 10 of 15
(7,654 Views)