連番のファイルで欠番がある場合
Afficher commentaires plus anciens
ワークスペースにある連番の構造体(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
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur ファイルの操作 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!