![]() ![]() ![]() Here's a function that searches recursively through all subdirectories of a given directory, collecting a list of all file names it finds: function fileList = getAllFiles(dirName)ĭirData = dir(dirName) %# Get the data for the current directoryĭirIndex = %# Find the index for directoriesįileList = ) įilePathComplete = fullfile(nextDir,getAllFiles(k,1). s,w system ('wc -l yourfile.dat') and then get the number of lines from the returned text (which is stored in w ). NOTE: In newer versions of MATLAB (R2016b and later), the dir function has recursive search capabilities! So you can do this to get a list of all *.m files in all subfolders of the current folder: dirData = dir('**/*.m') It's also worth bearing in mind that you can use your file system's in-built commands, so on linux you could use the command. ![]() Theme Copy x010 y010 width550 height400 set (gcf,'position', x0,y0,width,height) You can specify other units (inches, centimeters, normalized, points, or characters). file size, content, creation date, etc.). Accepted Answer Lucifer on 6 Set the ‘Position’ property on the current figure (gcf). In addition, I added the ability to apply a validation function to each file, allowing you to select them based on criteria other than just their names (i.e. It now gives you options to prepend the full path or return just the file name (incorporated from Doresoom and Oz Radiano) and apply a regular expression pattern to the file names (incorporated from Peter D). My newest code can be found on The MathWorks File Exchange: dirPlus.m. Update: Given that this post is quite old, and I've modified this utility a lot for my own use during that time, I thought I should post a new version. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |