Grab a file without writting full name
4 ビュー (過去 30 日間)
古いコメントを表示
I want to grab a file that is always located in same folder that starts with the name "Target" and ends with ".hex" but in front of Target there is a version number that can change.
In the following line you can see I'm trying to use the " * " to pick up any file. But this doesn't work. Anyone can help me how to do this?
firmwareFile = [basePath{1} '..\binaries\Target*.hex'];
0 件のコメント
回答 (1 件)
Kevin Holly
2022 年 10 月 19 日
編集済み: Kevin Holly
2022 年 10 月 19 日
Can you try this?
folder = [basePath{1},filesep,'binaries']; % I'm assuming this is the folder location
firmwareFiles = dir(fullfile(folder,'Target*.hex'))
11 件のコメント
Kevin Holly
2022 年 10 月 20 日
To detect if it is empty:
isempty(firmwareFiles)
To detect how many files were detected:
size(firmwareFiles,1)
参考
カテゴリ
Help Center および File Exchange で Package and Share Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!