Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Why did i receive the error "Subscripted assignment dimension mismatch"?

조회 수: 1 (최근 30일)
Munkhtsetseg Gantulga
Munkhtsetseg Gantulga 2016년 2월 16일
마감: MATLAB Answer Bot 2021년 8월 20일
I created these matrix: A(1x4), B(4x4). But in editor tab when i was creating a function which is multiplied those matrixs and check it, i've got "Subscripted assignment dimension mismatch." error. Why? And how can i solve it?
  댓글 수: 1
KSSV
KSSV 2016년 2월 16일
It will work. You check the dimensions of your matrices. Remember the matrix multiplication rule: Matrices of order mXn, nXp can ve multiplied.
>> A = rand(1,4)
A =
0.4387 0.3816 0.7655 0.7952
>> B = rand(4,4)
B =
0.1869 0.7094 0.6551 0.9597
0.4898 0.7547 0.1626 0.3404
0.4456 0.2760 0.1190 0.5853
0.6463 0.6797 0.4984 0.2238
>> A*B
ans =
1.1239 1.3510 0.8369 1.1770

답변 (1개)

Kallam Haranadha Reddy
Kallam Haranadha Reddy 2018년 1월 26일
First pre allocate the A and B matrices. You will get the error message which you got if they are not pre allocated

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by