LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Splitting a string into a table.

I got a sting with some measure results. But the form of that string is
nog suitable for further processing.
I like to put these results into an Excel sheet or something.

The form is

-5V 10nA
-4V 20nA

So ik have to split the sting into two collums and I must get rid of
that V and nA stuff !
Instead I would like to replace the nA into 10^-9, so I can directly
import the
numbers with the right units.

Anybody a sample application, tips how I can split or replace the nA and
V-things ?

Thanx in advance !!

Kristof
Sipex
Belgium
0 Kudos
Message 1 of 7
(2,736 Views)
Play with attached vi.
Sergey
Message 2 of 7
(2,736 Views)
On Tue, 27 Feb 2001 08:56:42 +0100, Kristof Poppe
wrote:

>I got a sting with some measure results. But the form of that string is
>nog suitable for further processing.
>I like to put these results into an Excel sheet or something.
>
>The form is
>
>-5V 10nA
>-4V 20nA
>
>So ik have to split the sting into two collums and I must get rid of
>that V and nA stuff !
>Instead I would like to replace the nA into 10^-9, so I can directly
>import the
>numbers with the right units.


To split the string use "Scan From String" with
'Format String' set to "%fV %fnA"
To rebuild use "Format Into String" with
'Format String'set to "%.2f %fE-9"

Change the 'Format string' to you get what you need

Hope this helps
--
Rolf
Message 3 of 7
(2,736 Views)
I already worked with that. But the difference is that the data is sometimes
two collums, than three, another is just one collum, and all with nA en mA's
mixed.
I now convert is form mA to E-3A and then I convert it to an array.


"Rolf Østvik" wrote:

> On Tue, 27 Feb 2001 08:56:42 +0100, Kristof Poppe
> wrote:
>
> >I got a sting with some measure results. But the form of that string is
> >nog suitable for further processing.
> >I like to put these results into an Excel sheet or something.
> >
> >The form is
> >
> >-5V 10nA
> >-4V 20nA
> >
> >So ik have to split the sting into two collums and I must get rid of
> >that V and nA stuff !
> >Instead I would like to replace the nA into 10^-9, so I can directly
> >import the
> >numbers with t
he right units.
>
> To split the string use "Scan From String" with
> 'Format String' set to "%fV %fnA"
> To rebuild use "Format Into String" with
> 'Format String'set to "%.2f %fE-9"
>
> Change the 'Format string' to you get what you need
>
> Hope this helps
> --
> Rolf
0 Kudos
Message 4 of 7
(2,736 Views)
You can use the "Spreadsheet String to Array" to convert the string into an
array of strings that preserve the units. You then need to write a function
that looks for the unit, removes it, converts the remainder of the string to
a number and then multiplies that number by the factor indicated by the
unit. In fact, it's such a simple function I've just done it and attached it
in LV6 format. Obviously not been comprehensively tested and I've only put
in milli, micro and nano scale factors but it's enough to get the idea
across. Put this function within two nested FOR loops and it'll convert all
the elements in your string array to numbers.

Using this method, the array you get out is of the same form as the data you
put in.

Kristof Poppe sipex.be> wrote in message
news:3A9B8474.4C9FB0@sipex.be...
> I already worked with that. But the difference is that the data is
sometimes
> two collums, than three, another is just one collum, and all with nA en
mA's
> mixed.
> I now convert is form mA to E-3A and then I convert it to an array.




[Attachment Numeric - String with Units to Scaled Number.vi, see below]
0 Kudos
Message 5 of 7
(2,735 Views)
On Tue, 27 Feb 2001 11:41:56 +0100, Kristof Poppe
wrote:

>I already worked with that. But the difference is that the data is sometimes
>two collums, than three, another is just one collum, and all with nA en mA's
>mixed.
>I now convert is form mA to E-3A and then I convert it to an array.
>
>
>"Rolf Østvik" wrote:
>
>> On Tue, 27 Feb 2001 08:56:42 +0100, Kristof Poppe
>> wrote:
>>
>> >I got a sting with some measure results. But the form of that string is
>> >nog suitable for further processing.
>> >I like to put these results into an Excel sheet or something.
>> >
>> >The form is
>> >
>> >-5V 10nA
>> >-4V 20nA
>> >
..
..
..
>>
>> To split the string use "Scan From String" with
>> 'Format String' set to "%fV %fnA
"
>> To rebuild use "Format Into String" with
>> 'Format String'set to "%.2f %fE-9"
>>
>> Change the 'Format string' to you get what you need

For example a string like this:
-5V 10nA 5mA

First a format string with "%fV"
then in a while loop (with some shift registers) use
Use "Scan from string" with " %f[^ ]"
Dont use a shift register on the input string.
wire The 'Initial Scan Location' and 'Offset past scan'
to shift registers
(you get a a number output and a string output)
The number output is the value
The string is mA, nA, uA.
Send the string through "Index & Strip" which
has an input array with "A", "mA", "uA"....
Use the number from that to select a case which select your
exponent
end your while loop when 'Offset past scan' is <=the lenght of the
string.

(Formatting of the end string is left for you)

Hmm, not easy to describe graphical programming with text.

If you want, send me some of the input data and how you want it
formatted by e-mail
and i can send you a VI.

--
Rolf
0 Kudos
Message 6 of 7
(2,735 Views)
SOLVED !!

Thanks a lot for your inforamation. I was working on that way.
But there's one big problem. The data units are extremely random.
In the data the first collum is voltage, but on another measurement it's current
!!
I wrote now a VI that can cope with this, including your shift registers !

Kristof

"Rolf �stvik" wrote:

> On Tue, 27 Feb 2001 11:41:56 +0100, Kristof Poppe
> wrote:
>
> >I already worked with that. But the difference is that the data is sometimes
> >two collums, than three, another is just one collum, and all with nA en mA's
> >mixed.
> >I now convert is form mA to E-3A and then I convert it to an array.
> >
> >
> >"Rolf �stvik" wrote:
> >
> >> On Tue, 27 Feb 2001 08:56:42 +0100, Kristof Poppe
> >> wrote:
> >>
> >> >I got a sting with some measure results. But the form of that string is
> >> >nog suitable for further processing.
> >> >I like to put these results into an Excel sheet or something.
> >> >
> >> >The form is
> >> >
> >> >-5V 10nA
> >> >-4V 20nA
> >> >
> .
> .
> .
> >>
> >> To split the string use "Scan From String" with
> >> 'Format String' set to "%fV %fnA"
> >> To rebuild use "Format Into String" with
> >> 'Format String'set to "%.2f %fE-9"
> >>
> >> Change the 'Format string' to you get what you need
>
> For example a string like this:
> -5V 10nA 5mA
>
> First a format string with "%fV"
> then in a while loop (with some shift registers) use
> Use "Scan from string" with " %f[^ ]"
> Dont use a shift register on the input string.
> wire The 'Initial Scan Location' and 'Offset past scan'
> to shift registers
> (you get a a number output and a string output)
> The number output is the value
> The string is mA, nA, uA.
> Send the string through "Index & Strip" which
> has an input array with "A", "mA", "uA"....
> Use the number from that to select a case which select your
> exponent
> end your while loop when 'Offset past scan' is <=the lenght of the
> string.
>
> (Formatting of the end string is left for you)
>
> Hmm, not easy to describe graphical programming with text.
>
> If you want, send me some of the input data and how you want it
> formatted by e-mail and i can send you a VI.
>
> --
> Rolf
0 Kudos
Message 7 of 7
(2,735 Views)