필터 지우기
필터 지우기

how to fix this code?

조회 수: 2 (최근 30일)
Firas Al-Kharabsheh
Firas Al-Kharabsheh 2016년 4월 16일
댓글: John D'Errico 2016년 4월 16일
A = [ 1 1 1 0 0 0 0 0 1 1
1 1 0 0 0 0 0 1 0 1
1 1 0 0 0 0 0 1 0 1
1 1 0 0 0 0 0 0 0 1
1 1 1 0 0 0 0 0 1 1
1 1 1 1 0 0 0 1 1 1
1 1 1 1 1 0 1 1 1 1 ]
[n,m]=size(A)
s=sum(A,2)
for k=1:n
idx(k,1)=~isempty(strfind(A(k,:),[1 0 1]))
end
ii=s>m/2 & idx
out=A(ii,:)
when i run this code this error appear " Matrix dimensions must agree " with ii=s > m/2 & idx
  댓글 수: 1
John D'Errico
John D'Errico 2016년 4월 16일
We don't know what you want to get out of that code. So fixing the code, so it produces no errors is easy. Here is one way:
out = eye(10);
Since you have not said what you expect, that is as good an answer as any other.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by