How to use DIR function
3 次查看(过去 30 天)
显示 更早的评论
I'm using this code:
MatFileDirectories = MatFileDirectories(1)
MatFileDetails = dir(MatFileDirectories)
but I get this error:
_??? Error using ==> dir
Function is not defined for 'cell' inputs._
Mat file directories is an array containing all the drive paths of the mat files:
MatFileDirectories = {
'C:\blahblah'
'C:\blahblah'
'C:\blahblah'
'C:\blahblah'
};
I don't get why it can't read the path from the array
0 个评论
采纳的回答
Image Analyst
2012-9-5
编辑:Image Analyst
2012-9-5
Common mistake, use braces instead of parentheses:
MatFileDirectories = MatFileDirectories{1};
In general, anytime you have problems with cell arrays, switch from () to {}, or from {} to (). Chances are, one of them will work. Another useful tip is to learn about the cell2mat() and char() functions.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 File Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!