single row matrix vector subtraction
2 次查看(过去 30 天)
显示 更早的评论
i require the following calculation but my trial failed hope some one can help in this i have two matrices best=1x100 matrix and WIN=10x100 matrix and my problem is to subtract every row of WIN matrix with singe row matrix best i have used for loop but finally its giving one 1x100 ie., only 10th row but i require all the 10 rows ie 10x100 matrix after subtraction in a single variable
0 个评论
采纳的回答
Andrei Bobrov
2012-10-23
best=randi(20,1,100);
WIN=randi(40,10,100);
out = bsxfun(@minus,WIN,best);
3 个评论
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!