If there are 2 matrices a and b, what does (b) do in matlab?

If I have a matrix, let's say

a = [1 2 3; 4 5 6] 

and

 b = [2 2 2; 3 3 3] 

when I do a (b) in matlab, I get the answer as

 a(b) = [4 4 4; 2 2 2] 

what exactly is going on here?

+6
source share
1 answer

You index a with each element in b . a(2) = 4 and a(3) = 2

So

 c = [a(2) a(2) a(2); a(3) a(3) a(3)] 

- this is what you see.

+4
source

Source: https://habr.com/ru/post/954875/


All Articles