LabVIEW Idea Exchange

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

Allow empty string as spreadsheet delimiter.

Status: New

There are examples of generic ASCII spreadsheet formats that used fixed-width fields and no delimiter. (see for example the XMAP section of XPLOR files for crystallographic electron density, blue part below).

 

 


ZYX
XMAP: section #   0 average density=-0.336     sigma= 0.907   
       0
-0.97086E+00-0.49927E+00-0.82774E+00-0.13491E+01-0.57034E+00-0.71253E-01
-0.19491E+00 0.61017E+00 0.10064E+01-0.22888E+01-0.94020E+00 0.77451E+00
 0.57539E+00-0.31211E-01-0.27430E+00-0.36526E+00 0.34772E+00 0.81884E+00

-0.19954E+01-0.10117E+01 0.18038E+01 0.19008E+01 0.11886E+00-0.41646E+00
 0.47560E-01 0.48855E+00 0.57606E+00-0.22320E+00-0.12787E+01 0.47590E+00

...


 

LabVIEW could easily deal  with these sections (i.e. read and write!) using "%12.5e" as format string and an empty string as delimiter. For some reason, an empty string as delimiter does not work for "spreadsheet string to array" and "array to spreadsheet string". If I explicitly wire an empty string to the delimiter input, LabVIEW will silently substutite a tab instead. This is somewhat unexpected, a tab should only be substituted if the input is unwired.

 

IDEA: An explicit emtpy delimiter string input should be accepted verbatim. 

 

Of course things can go horribly wrong if the field code is variable width, but we need to trust the programmer to be aware and deal with it.

 

(On a related note, there is still no format code to allow padding the exponent to two digits with zeroes as in the blue parts shown above, however, fortunately the files seem compatible even if I don't edit the exponent to match that pattern)

Message Edited by altenbach on 07-21-2009 12:02 PM
2 Comments
TCPlomp
Trusted Enthusiast

Related to CAR#250792

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
aschipfl
Member

The way to deal with an empty delimiter is quite obvious for the Array To Spreadsheet String function.

 

For the Spreadsheet String To Array function, the programmer needs to specify the exact field width.

But if he does not, how should the function behave then?

  • should it treat each line as a single field (this might sound more logical from a macroscopic point of view),
  • or should it "see" a delimiter (empty string) in between every character (like the Search and Replace String function does with an empty search string given; this might be more logical when you think of how Spreadsheet String To Array works: first it splits each line into multiple fields using the delimiter, then it scans each field using the format string)?

What is your opinion?

 

(By the way: when the input array of Spreadsheet String To Array consists of string elements, the width (e. g., "%3s") seems to be ignored; is that the intended behaviour??)


 

[related to: #3165100]