List all matlab files in python
7 次查看(过去 30 天)
显示 更早的评论
Hi. I need to convert the following matlab code to python:
DirList = dir(fullfile(Folder, '*.mat'));
Data = cell(1, length(DirList));
Do you have an idea of how to do it in python?
回答(1 个)
Al Danial
2022-10-4
from glob import glob
Dir = '.'
mat_files = glob(f'{Dir}/*.mat')
to create the Python list mat_files.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call Python from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!