Compare matrix 16000 X 20000 with smaller matrix 16000X1

1 view (last 30 days)
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 Comment
Rik
Rik on 4 Nov 2021
Implicit expansion was added in R2016b. Since you're using R2018a, this should work, as KSSV notes below.

Sign in to comment.

Accepted Answer

KSSV
KSSV on 4 Nov 2021
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

More Answers (0)

Tags

Products


Release

R2018a

Community Treasure Hunt

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

Start Hunting!