Effacer les filtres
Effacer les filtres

Coder - Subtract vector from matrix, size mismatch error

2 vues (au cours des 30 derniers jours)
amin ya
amin ya le 28 Avr 2019
Modifié(e) : amin ya le 12 Juin 2019
Although MATLAB supports subtracting a vector from a matrix (as stated here : https://www.mathworks.com/help/matlab/matlab_prog/compatible-array-sizes-for-basic-operations.html ), 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()
A=3*ones(4,5);
B=ones(1,5);
C=A-B;
end
What should I do?

Réponse acceptée

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

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Coder dans Help Center et File Exchange

Produits


Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by