Very often MATLAB users want to be able to process a set of files from a directory. In this video, I show how you can look through a directory seeking files of the form “data###.dat” and then returning the “###” as a number with any leading zeros removed. This makes use of regular expressions, but does not explain their theory much at all.
This is not the first time this kind of thing has been discussed. Check out Loren’s take, or Steve’s take from their blogs.
nice. just a thought:
rather than trying ideas in the command window, one idea is to do this using the editor in cell mode. that way, when you’ve figured out the right syntax, you almost have a finished script. this also saves scrolling through the command history for the correct version of each command which after trial-and-error often look similar to versions that don’t quite work
Off topic, but David’s reply made me think about an enhancement I would like to see. Imagine scrolling up through the command history, either through the editor or by using the up arrow. When you came across a command that caused an error, it would be in red font. Boy that would make life simpler when looking through several similar commands, some of which didn’t work.
Actually, I tend to do a little bit of both. It is hard to say when I work at the command line and then script and when I write a script and just keep running it as you add to it.
That is an excellent suggestion. I just posted it to our internal enhancement tracking database. You can make such requests more reliably by e-mailing support@mathworks.com
Have you tried the procedure with a much smaller dataset to make sure you are doing everything right? If it works with a smaller dataset, then we can take it from there.
Doug
Leave a Reply
About
Doug Hull is a proud MathWorker who is on a mission to help you with MATLAB.
nice. just a thought:
rather than trying ideas in the command window, one idea is to do this using the editor in cell mode. that way, when you’ve figured out the right syntax, you almost have a finished script. this also saves scrolling through the command history for the correct version of each command which after trial-and-error often look similar to versions that don’t quite work
regards,
david
Off topic, but David’s reply made me think about an enhancement I would like to see. Imagine scrolling up through the command history, either through the editor or by using the up arrow. When you came across a command that caused an error, it would be in red font. Boy that would make life simpler when looking through several similar commands, some of which didn’t work.
David,
Actually, I tend to do a little bit of both. It is hard to say when I work at the command line and then script and when I write a script and just keep running it as you add to it.
Doug
Matt,
That is an excellent suggestion. I just posted it to our internal enhancement tracking database. You can make such requests more reliably by e-mailing support@mathworks.com
Thanks,
Doug
I saved a big(>2GB) .mat file on an external HD using
save -v7.3 myfile.mat filetosave
I try loading the file back
with
load myfile.mat
and get an error message that file cannot be read.
Any help?
@onassis
Have you tried the procedure with a much smaller dataset to make sure you are doing everything right? If it works with a smaller dataset, then we can take it from there.
Doug