Matlab drive code#
%// let's get the folder list in a variable (but you can easily hard code it if you preferįolderList = cellstr( ls(baseShareName) ) %// cellstr wrapping call otherwise the output is a char array Then without resorting to external command, you can get a list of the files you are interested in by: baseShareName = '\\CASTOR\SharedFolder\testdata' I've created a directory structure and files according to your example on a shared drive: And you don't even have to change your working directory -)
The Matlab function ls can do that for you. If you are only using cd and dir to get a list of file names which you can later open in Matlab, you don't need to use a dos command. Which returns: H:\testdata\c\day1\somedatafile_1.abc
It should be noted that this functions correctly if I mount the network drive and use that path instead: searchpath = 'H:\testdata\c' Use fopen to generate a valid file identifier. However, these are not valid paths to use with low level I/O: Error using textscan This returns a cell array of filenames: Z:\day1\somedatafile_1.abc Google Drive is a safe place for all your files Get started today. = system('dir /S /B somedatafile_*.abc') įilelist = regexp(filenames, '(.:\\+\.\w+)', 'match') % Split filenames Oldpath = cd(searchpath) % cd to data directory for simpler dir call You can create and share a view-only link to allow other users to vie. My function parses through the user specified folder, c in this case, and looks for all of the data files that match the filter: searchpath = '\\mynetworkshare\testdata\c' Share folders in MATLAB Online and MATLAB Drive to collaborate using MathWorks Cloud. With somedatafile_n.abc in each of the day folders. My Google-fu has been defeated.Īs an example, say I have this file structure on \\mynetworkshare \\mynetworkshare\testdata\a
Matlab drive windows#
while debugging this morning I discovered something strange (to me) and I'm curious to know why Windows (Win7, 64 bit) behaves this way. I have a processing function that I'm using to perform data reduction and our data is stored on a network drive. Apologies in advance for not being able to provide a completely reproducible example, not everyone is going to have a network drive to experiment with.