how to multiply a row with 1st and 2nd row of a matrix seperately
1 次查看(过去 30 天)
显示 更早的评论
>> y_0
y_0 =
0 1 1 0 1 0 0 1 0 1 1 0 1 0 0 1
>> z
z =
1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
1 0 0 1 0 1 1 0 1 0 0 1 0 1 1 0
I am trying to multiply y_0 with row 1 of z and row 2 of z. but I am not sure how
i tried :z and z: but its giving errors. Kindly help
回答(2 个)
Cris LaPierre
2018-12-8
If you are new to MATLAB, I'd suggest MATLAB Onramp. Chapter 6 talks about performing calculations with arrays.
0 个评论
Star Strider
2018-12-8
y_0 = [0 1 1 0 1 0 0 1 0 1 1 0 1 0 0 1];
z = [1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0
1 0 0 1 0 1 1 0 1 0 0 1 0 1 1 0];
Out = bsxfun(@xor, y_0, z)
producing:
Out =
2×16 logical array
1 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!