Matlab Subscripted assignment dimension mismatch error -
i'm trying perform row multiplication 2 matrices: a
, b
.
a subscripted assignment dimension mismatch
error thrown on line c(1,i) = a(i,:)*b;
.
do have syntax error causing dimensions on left , right sides of =
sign unequal?
function c = rowproduct(a,b) [n,m]=size(a); [p,q]=size(b); c=zeros(1,n); if( m == p) i=1:n c(1,i) = a(i,:)*b; end else error('matrix dimension mismatch'); end end
try replace c(1,i) = a(i,:)*b;
c(i,:) = a(i,:)*b;
Comments
Post a Comment