필터 지우기
필터 지우기

single row matrix vector subtraction

조회 수: 1 (최근 30일)
PK
PK 2012년 10월 23일
댓글: QuanCCC 2019년 1월 17일
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

채택된 답변

Andrei Bobrov
Andrei Bobrov 2012년 10월 23일
best=randi(20,1,100);
WIN=randi(40,10,100);
out = bsxfun(@minus,WIN,best);
  댓글 수: 3
Andrei Bobrov
Andrei Bobrov 2012년 10월 23일
please read about function bsxfun
QuanCCC
QuanCCC 2019년 1월 17일
bsxfun is very useful. Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Sachin Ganjare
Sachin Ganjare 2012년 10월 23일

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by