フィルターのクリア

How can I get arguments in my MATLAB batch script to use a series of files with different character strings?

9 ビュー (過去 30 日間)
I'm fairly new to MATLAB, so apologies if this is unclear or poorly-worded.
I have some files I want to use in a batch script, but the files currently have different names across different folders - is it possible to use these files as they are and get my script to read them? The file will be run using a bash script, and the script uses/operates in SPM12.
The files have this same general format across all the folders, but different character strings after 202:
Physio_202*_PULS.log
They also have same general paths, all located in:
.../[subject]/physio
The current arguments are formatted like this:
{['/location/' subject '/physio/' subject '_PULS.log']};
The 'subject' argument pulls information from a text file nominated when running the script in bash.
Would replacing the second 'subject' with something like 'Physio_202*_PULS.log' work?
  4 件のコメント

サインインしてコメントする。

採用された回答

Stephen23
Stephen23 2024 年 3 月 18 日
編集済み: Stephen23 2024 年 3 月 18 日
S = dir('/location/*/physio/*_PULS.log');
for k = 1:numel(S)
F = fullfile(S(k).folder,S(k).name);
T = readtable(F); % or READCELL, READMATRIX, etc
% do whatever with your imported data
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by