dpb
Posts:
6,689
Registered:
6/7/07
|
|
Re: Help using textscan or sscanf
Posted:
Jan 20, 2013 9:39 AM
|
|
On 1/20/2013 12:48 AM, Kevin Ellis wrote: ...
> I feel bad. I knew this was a challenging problem, but I'm impressed. > The solution you came up with significantly reduces the runtime. One > thing I should mention is that I have had to copy the section of code 12 > times for each month of the year. I call the dataset using datenum for > each month ('001' for October all the way to '012' for September).I > append that number onto the end of the number that your code made above.
Why would you replicate the code 12 times???? Wrap it in a function and pass the month or somesuch...
> So you were able to accomplish the task in much fewer lines of code > which is very impressive. Who knew it could be so simple. Too bad there > isn't a built-in function in MatLab where you can just read strings > right to left. That would make things much easier....
Well, again, if you want that function, write one that does it. A very high fraction of Matlab functionality is just that: m- or p-files that add the higher-level abstraction to the base language. Using the same ideas for user code simplifies development in a specific application domain.
--
|
|