配列インデックスのエラーメッセージについて
18 次查看(过去 30 天)
显示 更早的评论
下記のようなプログラムで、エラーメッセージが出ます。どのように直せば良いですか。
if ~isnan(t_TRGe_V(1))==1
for t = 2:length(t_TRGe_V)-1
pFp1_V = [pFp1_V;Fp1_V(t_TRGe_V(t)+analwin_eeg_V(1):t_TRGe_V(t)+analwin_eeg_V(2))'];
pFp2_V = [pFp2_V;Fp2_V(t_TRGe_V(t)+analwin_eeg_V(1):t_TRGe_V(t)+analwin_eeg_V(2))'];
pFC3_V = [pFC3_V;FC3_V(t_TRGe_V(t)+analwin_eeg_V(1):t_TRGe_V(t)+analwin_eeg_V(2))'];
pFC4_V = [pFC4_V;FC4_V(t_TRGe_V(t)+analwin_eeg_V(1):t_TRGe_V(t)+analwin_eeg_V(2))'];
pO1_V = [pO1_V;O1_V(t_TRGe_V(t)+analwin_eeg_V(1):t_TRGe_V(t)+analwin_eeg_V(2))'];
pO2_V = [pO2_V;O2_V(t_TRGe_V(t)+analwin_eeg_V(1):t_TRGe_V(t)+analwin_eeg_V(2))'];
pP5_V = [pP5_V;P5_V(t_TRGe_V(t)+analwin_eeg_V(1):t_TRGe_V(t)+analwin_eeg_V(2))'];
pP6_V = [pP6_V;P6_V(t_TRGe_V(t)+analwin_eeg_V(1):t_TRGe_V(t)+analwin_eeg_V(2))'];
end
配列インデックスは正の整数または logical 値でなければなりません。
エラー: EEG_test (行 82)
pFp1_V = [pFp1_V;Fp1_V(t_TRGe_V(t)+analwin_eeg_V(1):t_TRGe_V(t)+analwin_eeg_V(2))'];
0 个评论
采纳的回答
Kojiro Saito
2022-9-30
MATLABのエディターで該当行 (EEG_test.mの82行目)の行番号をマウスでクリックしてブレークポイントを設定してみてください。
下記の図では3行目をクリックした場合ですが、ブレークポイントが設定されると赤枠で表示されます。
【参考ドキュメント】ブレークポイントを設定する
そして再度スクリプトを実行してみて、ブレークポイントで一時停止した状態でコマンドウィンドウで
t_TRGe_V(t)+analwin_eeg_V(1):t_TRGe_V(t)+analwin_eeg_V(2)
を実行してみてください。
ここが正の整数になっていれば問題ないので、「再開」をクリックして次のfor文の繰り返しを実行します。
どこかのtの値で、t_TRGe_V(t)+analwin_eeg_V(1):t_TRGe_V(t)+analwin_eeg_V(2)がマイナスの値とか小数になっている可能性があります。
そしたらコマンドウィンドウで
t_TRGe_V(t)
や
analwin_eeg_V(1)
とか
analwin_eeg_V(2)
を実行して原因を特定できます。
更多回答(1 个)
Hernia Baby
2022-9-30
t_TRGe_V(t)+analwin_eeg_V(1):t_TRGe_V(t)+analwin_eeg_V(2)
上記が正の整数でないことが問題です。
Fp1_V の 0.001番目 と言われてエラーが起きてる感じです。
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 EEG/MEG/ECoG 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!