連番のファイルで欠番がある場合
Show older comments
ワークスペースにある連番の構造体(PLV_001、PLV_003、、、、、、PLV_023)を順に呼び出します。次に、
TFという要素(1000*1*8)を読み出し、squeezeをして(1000*8)、3次元方向にファイルを順に並べるということをしようと思っています。
が、1つ問題があり、連番の構造体には時々欠番があります。上記でいうと、PLV_002がありません。するとエラーが出ます
これをスルーする方法はあるでしょうか。ご教授ください。
*******
clear
clc
nfile = 19; % number of filels
plv = [];
load PLV.mat %PLV.matに構造体が保存されている。
for cnt=1:nfile
dname = sprintf('PLV_00%d',cnt);
data = strcat(dname,'.TF');
file = eval(data);
file2 = squeeze(file);
plv = cat(3,plv,file2);
end
Accepted Answer
More Answers (0)
Categories
Find more on ファイルの操作 in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!