変数tは未定義です.の意味が分からない.
Afficher commentaires plus anciens
data1=readmatrix('detaresult.xlsx');
n =0;
for i = 1:62
for k = 1:62
if data1(k,1)==i
n = n+1;
t{i,1} = n;
end
end
end
XTrain = cell(1,62);
for k=1:62
if k ==1
XTrain{1,k}=data1(1:t{k},5:156);
else
XTrain{1,k}=data1(t{k-1}+1:t{k},5:156);
end
end
ind = cellfun(@isempty,XTrain);
r_ind = all(ind,1);
XTrain(:,r_ind) = [];
ind(:,r_ind) = [];
c_ind = all(ind,2);
XTrain(c_ind,:) = [];
for k=1:734
XTrain{k} = rot90(XTrain{k});
end
data1acc=importdata('routeresult.xlsx');
data2acc=categorical(data1acc);
YTrain = cell(1,62);
for k=1:62
if k ==1
YTrain{1,k}=data2acc(1:t{k},:);
else
YTrain{1,k}=data2acc(t{k-1}+1:t{k},:);
end
end
ind = cellfun(@isempty,YTrain);
r_ind = all(ind,1);
YTrain(:,r_ind) = [];
ind(:,r_ind) = [];
c_ind = all(ind,2);
YTrain(c_ind,:) = [];
for k=1:62
YTrain{k} = rot90(YTrain{k});
end
layers = [ ...
sequenceInputLayer(22)
lstmLayer(300, 'OutputMode', 'sequence')
fullyConnectedLayer(2)
softmaxLayer
classificationLayer];
options = trainingOptions('adam', ...
'GradientThreshold',1, ...
'MaxEpochs',30, ...
'InitialLearnRate',0.0001, ...
'LearnRateSchedule','piecewise', ...
'LearnRateDropPeriod',100, ...
'Shuffle','every-epoch', ...
'ValidationData',{XTrain,YTrain}, ...
'ValidationFrequency',30, ...
'Verbose',0, ...
'Plots','training-progress');
net = trainNetwork(XTrain,YTrain,layers,options);
変数 t は未定義です。
1 commentaire
Hiroyuki Hishida
le 24 Déc 2021
表示されたメッセージがよくわからない時は、それをコピペしてgoogleするとヒントが見つかるかもしれません。
今回の場合、変数tは未定義です これをgoogleしたら、一番上にこれがでてきるかと思われます。 https://jp.mathworks.com/matlabcentral/answers/316883-xxxx
Réponses (2)
Atsushi Ueno
le 24 Déc 2021
Modifié(e) : Atsushi Ueno
le 24 Déc 2021
data1=readmatrix('detaresult.xlsx');
data1(:,1)' % 読み込んだデータの1列目を表示する。スペース削減の為転置する
n =0;
for i = 1:62
for k = 1:62
if data1(k,1)==i % ← 1~62と一致するデータが一つも無い為、このif内部は一度も実行されない
disp('一致した!') % ← 試しに表示してみても一度も表示されない
n = n+1;
t{i,1} = n; % ← tが作成されない
end
end
end
XTrain = cell(1,62);
for k=1:62
if k ==1
XTrain{1,k}=data1(1:t{k},5:156); % ← tが存在しない
else
XTrain{1,k}=data1(t{k-1}+1:t{k},5:156);
end
end
Seiki Ito
le 27 Déc 2021
0 votes
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!