LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

excel string cannot be imported to labview

Solved!
Go to solution

I want to import  column names in excel to labview by copying the excel strings and after pasting it to string constant and convert it to string array. But labview comes out a numeric array. I controlled format type. It is right but labview show them all 0. Why? What is wrong?

Egemen
0 Kudos
Message 1 of 16
(3,205 Views)

Hi newbieeng,

 

open the context help and read the help for the function you used...

 

It has an input in the lower left - and you didn't wire anything to it. So it uses the default input as described in the context help. When you want something different to be used at that input you have to wire that to this input. Pretty basic use of context help!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 16
(3,201 Views)

Hi newbieeng,

                              Run the program i attached. Hope this will be helpful.

 

Thanks

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 3 of 16
(3,189 Views)

Hi Ranjeet,

 

please be more careful when providing examples. Be clear and be correct according to context/LabVIEW help...

 

- What kind of format does your format string specify? "%S" isn't the correct one here...

- What's the goal of providing an array with predefined elements at the array type input? Is there a reason to have chars in that array? Is there a reason to have exactly 12 elements in that array?

- Use the cleanup tool before posting VIs...

 

When providing examples you should not confuse other users (which are trying to understand/learn LabVIEW) even more!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 16
(3,186 Views)

Hi gerdw,

                    I am not confusing anybody. This %S is my mistake and i admit it this happened becasue all the input to the array is in capitals (newbieeng know this because he only wrote %s).You are asking me why only 12 elements then why you are not asking newbieeng how many elements in his input.

 

And about your predefined strings. This is just an example and nothing else. No one can answer anybody perfectly becasue our environment is different. I posted this VI only to help him to some extent. Remaining he can manage. If he doesnot understands then he can ask me and i will help him from scratech and again post other VI with proper explanation.

 

 

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 5 of 16
(3,175 Views)

@GerdW wrote:

Hi newbieeng,

 

open the context help and read the help for the function you used...

 

It has an input in the lower left - and you didn't wire anything to it. So it uses the default input as described in the context help. When you want something different to be used at that input you have to wire that to this input. Pretty basic use of context help!


Hi GerdW,

 

Thank you for yuour reply. I have already checked the context help and main help file from labview before opening this thread. It is not explanatory. In the help document of spread sheet string to array, there is nothing  clean explanation. For the input that you mentioned, it directs to the array to spread sheet function help document. I also checked it and saw the example but there is nothing that I understand about how to implement it to string to spreadsheet array function.

Do we have different context and main help documents? I use labview 2009 SP1.

Egemen
0 Kudos
Message 6 of 16
(3,168 Views)

Hi Ranjeet,

Thank you for your reply but I could not open the vi because it is coded via LV 2011. I use 2009 SP1.

Egemen
0 Kudos
Message 7 of 16
(3,165 Views)
Solution
Accepted by topic author newbieeng

Here it is,

                        Let me know if you need any help

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 8 of 16
(3,162 Views)

Hi newbieeng,

 

we both use the same LabVIEW help (even when mine is in German, which usually is even worse). The help says:


array type is the data type input for the array. The default is a 2D array of double-precision, floating-point numbers.


 

You wanted to result an array of strings, but left that input unwired. And you wondered why you got DBLs instead.

Do you still wonder why you don't get an array of strings when you don't define the datatype properly?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 16
(3,161 Views)

Hi Egemen,

Spreadsheet string to Array is a ploymorphic vi and as you have not told it the type of output array you require, it has defaulted to a double array. All you have to do is wire the type of array you require and it will automatically change the output type as well.

Hope this helps.

 


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 10 of 16
(3,150 Views)