Coder - Subtract vector from matrix, size mismatch error

2 views (last 30 days)
amin ya
amin ya on 28 Apr 2019
Edited: amin ya on 12 Jun 2019
Although MATLAB supports subtracting a vector from a matrix (as stated here : ), when I try to generate code using MATLAB coder it gives me size mismatch error.
For example for the following function MATLAB can't generate code:
function C=subtraction()
What should I do?

Accepted Answer

Walter Roberson
Walter Roberson on 28 Apr 2019
specifically says that implicit expansion is not supported by Coder at this time.
The option is to use
C = bsxfun(@minus, A, B);

More Answers (0)

Community Treasure Hunt

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

Start Hunting!