ā01-16-2006 03:38 AM
Hello,
I have problem that looks easy, but not for me
I have done some work with LabView, but still hate the ASCII and string codes stuff. Canāt find the information what all this %s, %t, \n⦠e.c means. Pleas link me somewhere..
And my problem is:
I have ASCII spreadsheet like file. It has 2 lines of header and then columns (47 in example file). I need to convert this file in array for further work in LabView. But the problem is that delimiter between columns is multiple āspace- (see attached file) and not the same number of āspace- from column to column.
I need help in this⦠please give me some clue how to handle it.
Thank in advance,
Vadym
ā01-16-2006 04:34 AM
You can do it but you have to replace the space characters into a single delimiter. I have chosen the default tab character. It uses regular expressions to search the string for pattern matches then replaces any pattern matches with the tab character. This will them allow you to use the Spreadsheet String to Array function. Note that the leading spaces on each line will produce a tab which in turn leaves column 0 elements=0 so that has to be deleted after the Spreadsheet string to array function.
To demo this a have extracted the first few lines of the data section your data.
Have a look at the attached demo in LV7.1 which I hope will get you started.
David
ā01-16-2006 05:01 AM
ā01-16-2006 05:30 AM - edited ā01-16-2006 05:30 AM
Sorry I can only go back to 7.0.
Have a look at this picture to see if you can build it up yourself from there or somebody in the forum can help downconvert.

David
Message Edited by David Crawford on 01-16-2006 05:31 AM
ā01-16-2006 05:38 AM - edited ā01-16-2006 05:38 AM
Message Edited by devchander on 01-16-2006 05:40 AM
ā01-16-2006 05:47 AM
ā01-16-2006 06:07 AM
ā01-16-2006 06:25 AM - edited ā01-16-2006 06:25 AM
Message Edited by David Crawford on 01-16-2006 06:28 AM
ā01-17-2006 03:32 AM
David and Dev,
Thank you very much for help and I rate it as wellā¦
Here is my feedback; I think it will be interesting.
So, I tried and both of this vi is works well. But, when I start to convert bigger file 7-40 mb. Davidās solution appears very slow. I mean to find and replace pattern \s+ is really time and CPU consuming. While Devās solution works fast 16 sec for 40 mb ASCII file, but I have to set all parameters for 47 channels. And if I will have different number of channel form file to file, I have to make proper set of paramiters for āScan From Stringā in each case. Itās pity that LabView donāt have some property node for āScan From Stringā, and I can read from header how many channel I have and ask program to make appropriate set of āscan sequenceā. What can I do, is manually set it for each case from 1 to 128 channels
, put them in case structure and pick-up appropriate one that will correspond to number of channels written in header. Correct me if Iām wrong. And for header is better to use Davids protocol, because itās not constants string format as in columns (8 symbols), so itās better to replace all SPACE to TAB or just set SPACE as a delimiter (looks like there is just one SPACE between parameters).
Thank you again,
Vadym
ā01-17-2006 05:51 AM - edited ā01-17-2006 05:51 AM
Hi Vadym
That was interesting that the replacement of spaces with a tab takes a long time. The Search and Replace Pattern.vi has a free running loop without a small delay in it to keep the CPU loading down so it will be intensive on CPU time.
You will be able to build the flexibility for the number of channels in your data without resorting to case statements a bit like this.

David
Message Edited by David Crawford on 01-17-2006 05:51 AM