How to compare 2 matrix ?

I want to compare 2 matrix like this. for example first matrix I have 20 data and second matrix I have 100 data. can anyone help me ?

8 件のコメント

Adam
Adam 2017 年 10 月 27 日
Compare them in what way? It's not a uniquely defined operation!
Stephen23
Stephen23 2017 年 10 月 27 日
What exactly does "compare" mean? Here are some possible ways that they could be compared:
  • compare numbers of pixels per digit in that screenshot.
  • compare number of unique digits in each number.
  • compare significant figures per number
  • compare location within the digits of pi
  • convert to English words, and compare using bag-of-words.
  • compare hex values by how many 'F' there are.
  • etc., etc.
Which do you want?
Muhammad Hafiz
Muhammad Hafiz 2017 年 10 月 27 日
編集済み: Muhammad Hafiz 2017 年 10 月 27 日
if Sector.Selected.Cost(i,:) <= Scout.Cost(i,:)
New.Cost = Sector.Selected.Cost;
end
Sector is data on the left Scout is data on the right
Adam
Adam 2017 年 10 月 27 日
It still isn't obvious what you intend to be done with the fact you have 20 elements on the left and 100 on the right. Your example just indexes equally into both sides. What do you expect to happen with the other 80 values in the right-hand column? what do you compare them against?
Muhammad Hafiz
Muhammad Hafiz 2017 年 10 月 27 日
I mean, I want to compare both of values, because the size is not equal matlab can't process my program.
This is error message : Attempted to access Sector.Selected.Cost(29,:); index out of bounds because size(Sector.Selected.Cost)=[28,1].
Adam
Adam 2017 年 10 月 27 日
both of which values? In your example you have 20 and 100. What does 'both' mean?
Muhammad Hafiz
Muhammad Hafiz 2017 年 10 月 27 日
you can see the picture I put on my question? there are have 2 tables and I want to compare both of them to find the smallest value. can you help me :(
Adam
Adam 2017 年 10 月 27 日
You just keep repeating the same phrases though. If you want help you have to give details that allow people to help you. Just keep saying 'compare' is meaningless.
If you just want to find the minimum value across two different vectors then this is easy, but that isn't what I thought you wanted originally.
a = rand(20,1);
b = rand(100,1);
smallestVal = min( [a; b] )
will achieve that.

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

回答 (1 件)

KSSV
KSSV 2017 年 10 月 27 日

0 投票

doc ismember and ismembertol

カテゴリ

タグ

質問済み:

2017 年 10 月 27 日

コメント済み:

2017 年 10 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by