# LabVIEW

cancel
Showing results for
Did you mean:

## Convert 1D string Array to Numeric Array

I read a number of strings from GPIB card.They were divided by comma.What i do is saving them in numeric form and plot in waveform Control.Can somebody give some advice?
Message 1 of 8
(11,066 Views)

## Re: Convert 1D string Array to Numeric Array

What type of data you get from GPIB: 1d string array or 1 string, that consist many numbers. From your question i understand this is last case.
Look attached example.
Message 2 of 8
(11,066 Views)

## Re: Convert 1D string Array to Numeric Array

I am attaching a vi called Extract Numbers.vi. You input a string of numbers, separated by commas, and it outputs an array of the numbers. You may want to take a look at this. You can find this on National Instruments' website in their example program database. This should be what you're looking for.
J.R. Allen
Message 3 of 8
(11,066 Views)

## Re: Convert 1D string Array to Numeric Array

Mark_Wang wrote in message news:<5065000000080000009C4F0000-1023576873000@exchange.ni.com>...
> I read a number of strings from GPIB card.They were divided by
> comma.What i do is saving them in numeric form and plot in waveform
> Control.Can somebody give some advice?

Hi Mark,
if I've understood you correctly, you have say 5 elements in 1D
arrays of strings. Each element is related to a particular plot, so
each element is a comma deliminated string. You want to split this
into 5 1D numeric arrays, i.e. interpret each array element into a 1D
array, and pass this as an individual plot to a Waveform graph.

If this is so, try the following :
Place a for loop on the diagram. Wire the 1D array of strings to the
edge of the loop. Inside the loop place the Spre
array.vi (found under the string functions). To this, wire the 1D
array, with indexing ON to the spreadsheet string input. To the format
string input, wire a string constant of "%f" (without the quotes). To
the deliminator, wire a string constant of "," (without the quotes),
and to the Array type input, wire a 1D array of double precision
numerics (easiest way is to use the wiring tool, right click on the
input and create constant. Then select the constant, and remove a
dimension.
Wire the output of the Spreadsheet string to array.vi to the for loop
edge, and (with indexing ON on this point too) wire this output
directly to the waveform graph.
If that's a bit confusing, e-mail me direct, and I have the .vi I've
proved it on.

Hope that helps

Sash.
Message 4 of 8
(11,066 Views)

## Re: Convert 1D string Array to Numeric Array

This thread was started so long ago I hope I get a reply.

So first off Sash, those were excellent directions. I however get stuck at the last step, I don't know which graph VI to send the output to in order to get a XY graph (see attachment for how far I got...).
I am using LabView 7. 1
All I have is 2 inputs:
X axis will be channel numbers (coming from my mux module)--I get this in string format
Y axis will be a bunch of voltage readings (from my DMM)

Please let me know what the last step is so I can complete my waveform. Thanks!!!

Message 5 of 8
(10,631 Views)

## Re: Convert 1D string Array to Numeric Array

Show below is the basics for what you would do. Since all that you have provided is a image of a small piece of code, I have no idea how the data is your 2D array is arranged. The example below gets column 0 for the x array and column 1 for the y array. You may need to switch these around or to use the rows instead.

Message Edited by Dennis Knutson on 02-12-2008 07:40 AM
Message 6 of 8
(10,609 Views)

## Re: Convert 1D string Array to Numeric Array

Your VI is now obsolete and cannot be used...
Message 7 of 8
(7,878 Views)

## Re: Convert 1D string Array to Numeric Array

CU Boulder wrote:
Your VI is now obsolete and cannot be used...

Who is your comment directed towards?  And why in a 9-year old thread that hasn't been replied to in the last 3-1/2 years?

Message 8 of 8
(7,871 Views)