Determine whether input is a folder
result = isdir(folderName)
Check whether the input
myfile1.m is a folder. A result of 0 indicates that
myfile1.m is not a folder.
result = isdir('myfile1.m')
result = logical 0
Create the folder
myfolder, then check whether
myfolder is a folder. A result of 1 indicates that
myfolder is a folder.
mkdir myfolder; result = isdir('myfolder')
result = logical 1
Get the Current Folder listing and filter out only the folders.
Create two folders,
mkdir myfolder1 mkdir myfolder2
Get the current folder listing.
listing = dir;
Filter out only the folders.
onlyFolders = listing([listing.isdir]); onlyFolders.name
ans = '.'
ans = '..'
ans = 'myfolder1'
ans = 'myfolder2'
folderName— Name of folder
Name of the folder, specified as a character vector.
be specified as an absolute or relative path.
result— Indication of whether the specified name is a folder
Indication of whether the specified name is a folder, specified
1. If the specified
name is a folder,
result is 1. Otherwise,