LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Search for alphabets A - Z



@mechanical13 wrote:
Oops, I forgot to include the code..here it is.

This is definitely NOT the way to go!

Since we have these nice record delimiters, it is completely silly to try to match the variable parts (text or numbers) :o. All these extra loops, detours over DBLs, etc will cost you and can lead to errors. Scanning a string into a DBL and then formatting it again to the same string we had before is expensive and pointless. What if a set name does not start with a letter (e.g. "% humidity" or "$ US" or "\codes")?

My code processes your big datafile in well under one second. It could probably be made even faster.

Herea are a few more points:

  1. Index string array is "special purpose" for cases where you need to append to an existing string. It has limited use. A plain index array is sufficient. Best is autoindexing, as in my example, now you don't even need to wire N to the big FOR loop..
  2. Stay away from unneeded complex data structures such as your cluster. It does nothing useful in this case.
  3. If you write a DBL array to a spreadsheet, a format of "%s" is inappropriate.
  4. "Number of Files in Folder" should be I32.
  5. I am not sure why you "append" to the spreadsheet file. That should False! Right now, if you run your code multiple times, the xls file will grow without bounds. Since you have columnar data, appending will repeat the data at the bottom of the xls file, probably not something that would make a lot of sense.

 

Message Edited by altenbach on 09-19-2007 10:00 AM

Message 21 of 26
(1,222 Views)
Hi,
 
Maybee I have been missing something here (not the first timeSmiley Surprised)....
 
I looked at the first message saying:

       "I have a long columnar string with both numbers and alphabetical names in them.  The alphabets mark the begining of a new dataset.

        I want to be able to search for these names, without knowing what these names are, and where they are."

Thats the reason for "match pattern" And then in another early message:

       "Appreciate your reply. Yes, the fields in my string are delimited using linefeed, so its one long string many hundreds of thousands of lines long (typically).

        I've attached an example if you're interested in viewing it.  I"m trying to post process theses files using Labview and extract some statistics from them, so need to first     
        seperate them by field."

For post processing in Labview arrays of float would have been nice. So thats the reason for "scan float from string", at that time there where nothing said about storing in an excel file.
 
have a nice day !
Sture
0 Kudos
Message 22 of 26
(1,208 Views)
Sture
 
Sorry, I wasn't really talking about your early code suggestion, but about mechanical13's hack of it posted much later, after it became already clear that we have useful delimiters that are meant to be used. 🙂
 
Thanks for participating. I agree it took a long time to figure out what really needs to be done. Some treads need many iterations to come to a successful conclusion. 🙂
 
I have learned to not take question here too literally. Sometimes it helps to take a step back to get to the real core of the problem.
 
Sure the title: "Search for alphabets A - Z" has a clear atomic answer, but is actually not the solution to the fundamental problem here, which is "How do I parse a file that is structured as follows... ". It's like asking how to multiply if we actually want to do a fourier transform. 😄
 
On the endless quest for better code! 🙂

Message Edited by altenbach on 09-19-2007 11:36 AM

0 Kudos
Message 23 of 26
(1,198 Views)
This is awesome Altenbach.

Thanks to Sture and ALtenbach for all for their help!
0 Kudos
Message 24 of 26
(1,190 Views)
Sture, Altenbach,

My apologies if my subject line was unclear.

I'm trying to slowly build on the vi's and am sorry if I have been unclear in doing so.

While I will be writing these files for now to excel, that's not the end reason for this - I intend on using these columns of data for further processing.

As I anyways need to write to excel in the end, I thought it might make sense to do it as we move along that is why the nature of my questions changed. :((

My apologies for not being clear about it.

I appreciate both of your help a lot for helping out this rookie!

Cheers,

Janak
0 Kudos
Message 25 of 26
(1,176 Views)
No problem! 🙂
 
Just remember that you don't write any excel files here, just plain tab delimited ASCII with a fake xls extension. 😉
 
0 Kudos
Message 26 of 26
(1,162 Views)