LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

format string

Hello everyone,
 
I try to make a vi to reorganize the data from another software. For example, the original data is:
 
50.000         0.89833715   171.923544    0.00004445   122.834425    0.00003412   170.721934    0.00001356    10.025867
                    0.00000658    39.451120    0.00320565    85.793926    0.00028111    74.201572
98.125         0.86123238   168.233252    0.00012089   167.956648    0.00005808   177.248718    0.00006852   157.530610
                    0.00003249   155.691420    0.00656194    85.596244    0.00052533    91.360225
 
My target is:

50.000         0.898337 171.92 4.445e-5 122.83 3.412e-5 170.72 1.356e-5 10.026
                    6.580e-6 39.451 0.003206 85.794 2.811e-4 74.202
98.125         0.861232 168.23 1.209e-4 167.96 5.808e-5 177.25 6.852e-5 157.53
                    3.249e-5 155.69 0.006562 85.596 5.253e-4 91.360
 
After read file and get the original string, I tried the following ways:
 
1, directly using Fract/Exp String To Number.vi, only one data is formated, the others remains the same.
 
2, use while.vi each time convert one data in string to number, thats possible for a few datas, but since there are a lot datas in the string, the space between each data is different, which make impossible to do the loop.
 
I hope some one can share a bit experience, thanks in advance.
 
Jin
Munich,Germany
 
 
 
 

Message Edited by Munich on 04-03-2007 09:32 AM

0 Kudos
Message 1 of 6
(3,097 Views)
Under string funtions try "scan from string".
PaulG.

LabVIEW versions 5.0 - 2020

“All programmers are optimists”
― Frederick P. Brooks Jr.
0 Kudos
Message 2 of 6
(3,081 Views)
Hi PaulG,

I tried the scan string, get still only the 1st data..


   
0 Kudos
Message 3 of 6
(3,067 Views)
Do you have a specific format for each field or is it dependent on the value in that field? Are the fields separated by spaces or another delimiter plus some spaces?

I am thinking you may need to do this in several steps. First parse the input string into sets of strings. Then break up the sets and reformat according to the appropriate rules. Then recombine to the output format. Will the output also be strings or will it be numerical data?

Lynn
0 Kudos
Message 4 of 6
(3,060 Views)

Jin

 

Here is a VI that converts the numeric string to a 2D array of DBLs.  I am not sure if this is exactly what you want but it should be close.  I copied the string right from your email so it may not be exact.

The Search and replace replaces all spaces with a tab.  This gives you a tab delimited string.  It is now easy to convert into a 2D array.

 

David L. Hakey

CLA

Visualize the Solution

CLA

LabVIEW, LabVIEW FPGA
0 Kudos
Message 5 of 6
(3,047 Views)
Thanks a lot, due to the time difference, i am not in office now. can only try tomorrow.

Labview really needs a lot experience

   

0 Kudos
Message 6 of 6
(3,043 Views)