cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Convert 2D string array to 2D number array.

Convert 2D string array to 2D number array.

Hello,
 
I have the following problem. I need to convert a 2D string array to a 2D number array. My array exists out of 2 columns and x rows. So what I first did was this. Just splitted the array in two parts for each column. At that moment I had two 1D arrays next I converted it with a solution I found here at the forums. It works perfectly only isn't there a way to convert a 2D string array to 2D number array. I myself tried several things but unfortunaly I didn't manage. Anyone can help?
 
Thanks in regards,
 
- Wouter
0 Kudos
Message 1 of 10
(9,991 Views)

Re: Convert 2D string array to 2D number array.

You don't need aything special, the string/number conversion tools take arrays of any dimension. Smiley Happy
 
 
 


Message Edited by altenbach on 12-13-2007 03:32 PM

LabVIEW Champion Do more with less code and in less time
Message 2 of 10
(9,989 Views)

Re: Convert 2D string array to 2D number array.

You should use nested for loops and the Decimal String to Number.vi in the inner for loop, and use auto indexing coming out of each for loop to rebuild your array.  See the attached vi for an example.  Or use Altenbach's method as I suppose I should have advised you to do as well.

Cheers!


Message Edited by jmcbee on 12-13-2007 04:29 PM
CLA, CLED, CTD,CPI, LabVIEW Champion
President at Composed Systems
Using LV 2016, 2015, 2014


Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
0 Kudos
Message 3 of 10
(9,987 Views)

Re: Convert 2D string array to 2D number array.

Oh!!! Thanks man really Smiley Very Happy thank you both. Really thats awesome. I didn't know that was possible.
0 Kudos
Message 4 of 10
(9,982 Views)

reconstract string with hex string

the problem i have that i need to send hex string with lingth of 4 as (503D XX54) and the value of XX must change from (0 - FF) by switch array so i made constant strings (503D) and (54), and string (XX) must change by Switch array  then the three strings collected togather but with difreent format  so please if anyone can help me to solve this problem

0 Kudos
Message 5 of 10
(9,486 Views)

Re: reconstract string with hex string

Hi soliman,

 

the problem is you didn't provide any default data in your controls nor did you really describe what you want ("hex string with lingth of 4 as (503D XX54)" - that's a length of 9 chars for me...).

There's a difference between a string in hex display mode or hex numbers or simple strings! But that has been discussed so often in the forum you could easily find threads discussing your question... (Why the hell you're using mathscript to convert a number to a different number?)

 

In the meantime you may play with that:

17501iD36BAEEE083DF07D

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

0 Kudos
Message 6 of 10
(9,469 Views)

Re: reconstract string with hex string

 

hi sir

i realy thank you alot GerdW because your advise helpt me so match in my project

 with all of my respect

and thanks again and again

 

0 Kudos
Message 7 of 10
(9,421 Views)

Re: Convert 2D string array to 2D number array.

Hello, if you are still responding to this thread...I have a question.  How do you extend the significant digits to the number array?  I am trying to retain the forth number down in the attached array of text files: 15.0.txt - including the decimal ".0" after the 15.  The result I get is just ("15").

0 Kudos
Message 8 of 10
(1,283 Views)

Re: Convert 2D string array to 2D number array.

I am not sure what you want to achieve here (maybe a VI would help ?) but have you tried to play with the array Display Format ? Right click on it and see what's available Smiley Wink

CLAMaxime -- Kudos are a great way to say thank you
0 Kudos
Message 9 of 10
(1,276 Views)
Highlighted

Re: Convert 2D string array to 2D number array.

Hi Newton,

 

what about a better format string when creating those filenames?

Maybe "%.7f" would help!?

Best regards,
GerdW
CLAD expired, using 2009SP1 + LV2011SP1 + LV2017 (+LV2018 sometimes) on Win7+cRIO
Kudos are welcome Smiley Wink

Message 10 of 10
(1,272 Views)