Elementwise subtraction .- does not work

조회 수: 10 (최근 30일)
gehoon
gehoon 2016년 4월 1일
댓글: Walter Roberson 2016년 4월 1일
Hi, what would be causing following errors?
[1 3; 4 5] - [2 3] : dimension must agree Error
[1 3; 4 5] .- [2 3] : unknown operator ".-" Error
How could I operate following:
matrix A [m * n] - vector B [1 * n],
so that A(:,k) - B(k) = matrix [m * n]
This should be easy with .- operator but my MatLab refuses to cooperate.
Using MATLAB 2016a
  댓글 수: 1
Walter Roberson
Walter Roberson 2016년 4월 1일
There is no .- or .+ operator. The "." prefix is not a modifier that can be applied to any other operator: each of the operators that start with "." are defined individually.

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

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2016년 4월 1일
bsxfun(@minus,[1 3; 4 5],[2 3])

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by