output of evalc
Mostra commenti meno recenti
Hi, I am trying to load the filenames of 10000+ files (on a network path).
dir & ls seem the obvious commands, but they are both slow (33s for 18k files).
evalc on the other hand takes less than a second. (evalc('dir(...)')) however, the output is in a 1-d char array consisting of all filenames. There are spaces in the filenames as well, so that makes seperating a bit troublesome.
is it possible to get a different output format, or does anyone know a different "solution"?
Thanks! Jaap
PS. It's on a 32bit winXP
3 Commenti
Daniel Shub
il 10 Gen 2012
How are you mapping the network drive? Is it possible to run the dir command directly on the "server" and create a text file? This could speed things up a lot. Also, the way a drive is mounted can also influence how long things take.
Jaap
il 10 Gen 2012
Jaap
il 10 Gen 2012
Risposta accettata
Più risposte (2)
Jan
il 9 Gen 2012
1 voto
Are you sure that Str = evalc(['dir(', FilePath. ')']) and D = dir(FilePath); have such a large speed difference?! Or did you just call dir at first, such that evalc('dir') can access the cached data?
Please post a copy of the used code.
4 Commenti
Jaap
il 10 Gen 2012
Titus Edelhofer
il 10 Gen 2012
One of the problems is definetely the point "network" path. I just created a folder with 20000 files, and the command
blub = dir(pwd);
took 1.2 seconds. But for a network drive I get similar differences as you (about 20s for dir, 0.5s for evalc).
Titus Edelhofer
il 10 Gen 2012
Hmm, when scanning the output of evalc you already pointed out the main obstacle: filenames with spaces will give you a hard time (probably making this approach unusable).
Jaap
il 10 Gen 2012
Titus Edelhofer
il 10 Gen 2012
But you could try something similar:
p = s{2};
[a,b]=system(['dir /B "' p '"']);
It took about half the time of the dir() call ...
Titus
Categorie
Scopri di più su File Operations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!