??? Error using ==> eq Matrix dimensions must agree

[row, column]=find(My_matrix== pnode); I try to use this command and i get this error
??? Error using ==> eq Matrix dimensions must agree
What should i do?How i should write the syntaxis of it?

3 件のコメント

Adam
Adam 2015 年 4 月 15 日
What are the dimensions of My_matrix and pnode? I assume they are not the same size since you get that error and in that case it is impossible for any of us to know what your intention is in trying to test equality between them just from the information you have given.
Giannakis Stoukas
Giannakis Stoukas 2015 年 4 月 15 日
pnode is a variable and it has a value and the matrix has dimensions 10X14,this is why it is weird
Giannakis Stoukas
Giannakis Stoukas 2015 年 4 月 15 日
Actually the previous orders are min_cost = min(x(:)); [pnode, node] = find(x == min_cost); [row, column]=find(My_matrix == pnode); [rows, columns]=find(My_matrix==node);
and the min_cost instead of taking one value it takes an array

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

回答 (1 件)

John D'Errico
John D'Errico 2015 年 4 月 15 日
編集済み: John D'Errico 2015 年 4 月 15 日

0 投票

Your matrices are not compatible in size. READ THE ERROR MESSAGE!
Try this:
whos MY_matrix pnode
What does it tell you?

3 件のコメント

Giannakis Stoukas
Giannakis Stoukas 2015 年 4 月 15 日
The weird is that pnode is a variable with a single value,it isnt a matrix nor an array
Giannakis Stoukas
Giannakis Stoukas 2015 年 4 月 15 日
編集済み: John D'Errico 2015 年 4 月 15 日
Actually the previous orders are
min_cost = min(x(:));
[pnode, node] = find(x == min_cost);
[row, column]=find(My_matrix == pnode);
[rows, columns]=find(My_matrix==node);
and the min_cost instead of taking one value it takes an array
John D'Errico
John D'Errico 2015 年 4 月 15 日
I see that the last line has
find(My_matrix==node);
Even if pnode is a scalar, node may well not be so, since it was created from a previous call to find.

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

カテゴリ

ヘルプ センター および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

タグ

質問済み:

2015 年 4 月 15 日

コメント済み:

2015 年 4 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by