String fileName // File name or "" for dialog String pathName // Name of Igor symbolic path or "" for dialog The run number is loaded into a global variable named runNumber in the current data folder.įunction LoadNeutronData (pathName, fileName ) Don't forget to close the file at the end using Close.įor my own convenience I'm assuming that you have some experience with Igor programming, and that these instructions make sense. Repeat this for all the lines in the file, each time making a new wave. For each item call str2num and store it in the wave. For increased speed you can try looping over the string directly, though whether it's faster or not is hard to predict. Note that this is not very efficient but it should get the job done. Use StringFromList ( j, lineContents, " " ), where 'j' is the second loop counter. Then set up another for loop inside the first one that loops over all the items. Allocate a wave with the appropriate number of points. Subtract 2 from this to avoid counting the two header entries (or you can parse them if you like). Inside the for loop, get the number of entries in each line by calling ItemsInList (lineContents, " " ). Set up a for loop that calls FReadLine refNum, lineContents and breaks when FReadLine returns the empty string (lineContents is the name of a string variable that you declare). I assume someone from WaveMetrics will chime in on that. I'm not sure if the built-in LoadWave and friends can handle this natively. # Date_Time Iterationĝata (4000 points at 100.000000Hz).ěefore Precession = 52 s. the date/time in the format yyyy-mm-dd_hh:mm:ss.ddd_UTC Each line after the header is the equivalent of one wave, starting with There are 5 header lines I would like to ignore, except that I do want to take the run number (line 3) from it to use as a prefix for the wavenames I would be extremely grateful if someone here would help me figure out how to read in this data! I wasn't involved in the format schemes and have no control over them. I'm working on a project where data is generated for many different systems and while I have been able to manage with most of the files, this one format (shown below) has me stumped.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |