Elementwise subtraction .- does not work

9 Ansichten (letzte 30 Tage)
gehoon
gehoon am 1 Apr. 2016
Kommentiert: Walter Roberson am 1 Apr. 2016
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 Kommentar
Walter Roberson
Walter Roberson am 1 Apr. 2016
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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 1 Apr. 2016
bsxfun(@minus,[1 3; 4 5],[2 3])

Weitere Antworten (0)

Kategorien

Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by