Error using == Matrix dimensions must agree.

1 回表示 (過去 30 日間)
Novy Bua Rante
Novy Bua Rante 2018 年 2 月 26 日
コメント済み: Walter Roberson 2018 年 2 月 26 日
i have message error in matlab : Error using == Matrix dimensions must agree.
Error in Pengujian (line 39) [m,n] = find(output==target); please help me what can i do?
  3 件のコメント
Novy Bua Rante
Novy Bua Rante 2018 年 2 月 26 日
編集済み: Walter Roberson 2018 年 2 月 26 日
i will classification the image of green bean coffee using matlab with neural network backpropagation
---------
input = [metric;eccentricity];
target = zeros(1,96);
target(:,1:30) = 1;
target(:,31:51) = 2;
target(:,52:72) = 3;
target(:,73:96) = 4;
load net
output = round(sim(net,input));
[m,n] = find(output==target);
akurasi = sum(m)/total_images*100;
Walter Roberson
Walter Roberson 2018 年 2 月 26 日
Your net is not returning one result for each input, or else it is returning a column vector which you are trying to compare to a row vector. I suspect that is the problem, that you will need to transpose one of the two to compare them.

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 2 月 26 日
Assuming that you are trying to find the indices of each value of output within the matrix target, then:
[tf, idx] = ismember(output, target);
m = zeros(size(output));
n = zeros(size(output));
[m(tf), n(tf)] = ind2sub( size(target), idx(tf) );
Any value that does not appear within target will have m and n pairs of 0.

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by