필터 지우기
필터 지우기

Info

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

Matrix Dimensions Must Agree

조회 수: 1 (최근 30일)
baby
baby 2012년 10월 17일
마감: MATLAB Answer Bot 2021년 8월 20일
i got error in my code,,
it says Error using ==> / . Matrix Dimensions Must Agree
this is my code
a= input ('The number of participant :');
for c=1:a
str1 = ['Input Your Name :'];
str2 = ['Input Your First Score :'];
str3 = ['Input Your Second Score :'];
str4 = ['Input Your Third score :'];
b{c,1} = input(str1,'s');
b{c,2} = input(str2);
b{c,3} = input(str3);
b{c,4} = input(str4);
end
disp(b)
[m,n]= size (b);
Mb=max([b{:,2}])
fooCell = num2cell(NM);
for i=1:c
for j=1:3
R{i,j}=Mb{:,j}/b{i,j};
end
end
That error pointing at "/" in R{i,j}=Mb{:,j}/b{i,j};
anybody knows what's my fault?
please help me :)

답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2012년 10월 17일
편집: Azzi Abdelmalek 2012년 10월 17일
R{i,j}=Mb{:,j}/b{i,j};
what is Mb{:,j}?
and why Mb=max([b{:,2}])?
  댓글 수: 2
baby
baby 2012년 10월 17일
Mb is for decide the highest value in matrix "b"
anyway, is that wrong?
Azzi Abdelmalek
Azzi Abdelmalek 2012년 10월 17일
no it is not, the highest is
bb=cellfun(@double,b(:,2:end))
Mb=max(bb(:))

Walter Roberson
Walter Roberson 2012년 10월 17일
b{1,1} is a string, so you are trying to divide a matrix by a character vector.
By the way, have a look at the documentation for rdivide and compare it to the documentation for mrdivide

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

Community Treasure Hunt

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

Start Hunting!

Translated by