필터 지우기
필터 지우기

error in OR matrix for dimension

조회 수: 1 (최근 30일)
sara
sara 2014년 10월 19일
편집: Matt J 2014년 10월 19일
hello i have two matrix(M & M2) one of them M have 50 row and 32 column and the second one M2 has 50 row and 10 column i want to use OR logical with both of them, i used this code which i found here:
[m,n] = size(M);
M2 = [zeros(m,3*ceil(n/3)-n),M];
X = xor(xor(M2(:,1:3:end-2),M2(:,2:3:end-1)),M2(:,3:3:end));
nM = size(M,2);
nX = size(X,2);
n = max(M,X);
M = [zeros(m,n-nM),M];
X = [zeros(m,n-nX),X];
y = X|M
when i try to run the code it give me this error :
??? Error using ==> max
Matrix dimensions must agree.
Error in ==> ADD at 62
n = max(M,X);
how to solve this?

채택된 답변

Matt J
Matt J 2014년 10월 19일
n = max(nX,nM);
  댓글 수: 2
sara
sara 2014년 10월 19일
i have another issue, the output file(txt) give the matrix divided to column (column 1 through 14, column 15 through 28) how to make the matrix came without these column written on top? also the ans is on the top of the file...how to remove it ?
Matt J
Matt J 2014년 10월 19일
편집: Matt J 2014년 10월 19일
None of the code you've shown has any file writing commands, so everything you mention about the new problem is invisible. Since it's a different issue, however, you should probably pose it in a new thread, anyway.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Elementary Math에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by