を作成Matlab-:、Iは各ラインが予測ラベルが含まれている他の二つのセル配列を、そして私は混同マトリックスとして使用される以下の細胞マトリックス、た細胞混同行列
confusion=cell(25,25);
を有する(配列出力)と、実際のラベル(配列groundtruth)を含む別のセルマトリックス。私はに興味があった
Index exceeds matrix dimensions.
Error in write_confusion_matrix (line 4)
confusion{groundtruth{i},predict{i}}=confusion{groundtruth{i}, predict{i}}+1;
:
whos output
Name Size Bytes Class Attributes
output 702250x1 80943902 cell
whos groundtruth
Name Size Bytes Class Attributes
groundtruth 702250x1 84270000 cell
はその後、私は混乱行列
function confusion=write_confusion_matrix(predict, groundtruth)
confusion=cell(25,25);
for i=1:size(predict,1)
confusion{groundtruth{i},predict{i}}=confusion{groundtruth{i}, predict{i}}+1;
end
end
を作成するには、次のスクリプトを作成した。しかし、私はMathWorks社のMATLABでそれを実行すると、私は次のエラーを持っています印刷出力とグランドトゥルースの値を確認して何が起こっているかを確認する
だから、何も値が間違っているように見えるので、ここで何が間違っていますか?コード内の混同行列の索引付け権限ですか?
あなたは 'output'と' groundtruth'の両方の**最初の**値だけを表示しています。ループが失敗したときの反復 'i'では' groundtruth {i} 'または' {{{{}} 'が25より大きい可能性が最も高いです。コマンドプロンプトで 'dbstop if error'とタイプし、 'output'と' groundtruth'の両方が反復 'i'になっているので、あなたの投稿をこの情報で更新してください。 – rayryeng