isfile
确定输入是否为文件
说明
示例
输入是否为文件
检查输入 myfile1.txt
是否为文件。结果为 1 表示 myfile1.txt
是文件。
result = isfile('myfile1.txt')
result = logical
1
创建文件夹 myfolder
,然后检查 myfolder
是否为文件。结果为 0 表示 myfolder
不是文件。
mkdir myfolder; result = isfile('myfolder')
result = logical
0
检查输入 myfile1.txt
和 myfolder
是否为文件。结果为 [1 0]
表示 myfile1.txt
是文件,而 myfolder
不是文件。
result = isfile(["myfile1.txt", "myfolder"])
result = 1×2 logical array
1 0
输入参数
扩展功能
C/C++ 代码生成
使用 MATLAB® Coder™ 生成 C 代码和 C++ 代码。
用法说明和限制:
不支持在指定的路径中使用
file:
。在指定的路径中没有应用预处理。
在某些情况下,生成的代码的行为可能不同于 MATLAB®。在这些情况下,生成的
C
代码的行为与 UNIX® 上的stat
和 Windows® 上的GetFileAttributesA
的行为相匹配。
基于线程的环境
使用 MATLAB® backgroundPool
在后台运行代码或使用 Parallel Computing Toolbox™ ThreadPool
加快代码运行速度。
此函数完全支持基于线程的环境。有关详细信息,请参阅在基于线程的环境中运行 MATLAB 函数。
版本历史记录
在 R2017b 中推出
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)