short comments -- vish
2009/11/10 David Mertens <[email protected]> > Gabor - > > I felt like many of your questions deserved their own response, so I'm > going to send a few emails in a row addressing various questions you pose. > First, this: > > > Could you give use cases where a clever Matlab user would run a perl script >> to solve a problem more easily or faster than with standar Matlab tools? >> > > By clever Matlab user do you mean clever Perl user? Or clever Matlab > user? I think a clever Matlab user could write a Perl script to digest a > bunch of data and spit-out a csv file that Matlab could easily read and > process. I can't speak from experience on this one. > well i don't know about clever , but i am lazy from a theoretical point of view, both languages are Turing complete..... but practically a file that looks like 2009-09-08 12:34:56 , 0 , 1,2,3,4 , "some text i don't want to read" 2009-09-08 12:34:56 , NULL, 1,2,3,4 , "some text i don't want to read" can be read in matlab using regex or fscanf (and is as much fun as it is in C) in perl it is a one liner. so i first process the file in perl , and transform it to numbers. (i sometimes just leave the dates as 2009 09 08 12 34 56) > > Here's an example of how switching to PDL made my life easier, which I > think addresses your prompt. When in the lab, I take two signals of voltage > vs time. The first signal comes from an accelerometer and basically tells > me how my system is behaving - its the data I'm really interested in > analyzing. The second signal comes from the power supply, which really > ought to be constant over the course of a single measurement. When working > in Matlab, I would save both signals into a single ASCII file. The > filenames were based on the voltages that the power supply said it was > supplying to the system. When I analyzed the data using Matlab, I would > create string cell-arrays with all of the filenames I wanted to analyze > because I couldn't think of an easier way to analyze only a subset of the > data. > > Then I discovered PDL. I installed ActiveState Perl on my data-aquisition > system and wrote a small Perl script that repeatedly scanned a directory for > new files. I decided to save the voltage supply and the system response in > two different files. When the script found a new pair of files, it would > analyze the voltage signal and compute the mean and standard deviation of > the data, and rename the system-response data with a fully descriptive > filename: 'Motor05,0.462+-4.65e-4.dat'. This made my life much easier > becuase I didn't even have to pay close attention to my power supply anymore > to get the right filename. I just saved the files under something like > 'a_1.dat' and 'a_2.dat' and the perl script did the renaming for me. Later, > I learned that the power supply occasionally exhibited jumps in what it > supplied to my system, and finding bad data sets simply amounted to > identifying large error bars, which were already part of the fiile name. > > Could I have done this using Matlab? (1) No, because I didin't have a > license for Matlab on that computer. (2) No, because the thought of having > a Matlab script running in the background doing that file processing for me > never would have occurred to me. Implementing a Matlab solution that works > the way I think is not impossible, but it has too many barriers. > > David > > #1 is the super selling point . it is worse if you write a tool that you wish to deploy to others .
_______________________________________________ Perldl mailing list [email protected] http://mailman.jach.hawaii.edu/mailman/listinfo/perldl
