Compare matrix 16000 X 20000 with smaller matrix 16000X1

1 次查看(过去 30 天)
I tried to run code to compare big matrix.but cannot get the correct answer.
A = 16,000 X 20,000 data
B = 16,000 X 1 data
i want to get value of logical at C.
I tried C = A > B but return error 'dimension not agree'
can someone tell me the correct way to code this ?
Thank you.
  1 个评论
Rik
Rik 2021-11-4
Implicit expansion was added in R2016b. Since you're using R2018a, this should work, as KSSV notes below.

请先登录,再进行评论。

采纳的回答

KSSV
KSSV 2021-11-4
It should actually work.
A = rand(5) ;
B = rand(5,1) ;
C = A > B
C = 5×5 logical array
0 0 1 0 0 1 0 0 1 1 0 0 0 0 0 1 1 0 1 1 0 0 0 0 1
If it is throwing error, try:
B = reshape(B,1,5);
C = A > B
C = 5×5 logical array
0 0 1 1 0 1 0 0 1 1 0 1 0 0 0 0 1 0 1 0 0 0 0 0 1

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by