Borrar filtros
Borrar filtros

how to fix this code?

2 visualizaciones (últimos 30 días)
Firas Al-Kharabsheh
Firas Al-Kharabsheh el 16 de Abr. de 2016
Comentada: John D'Errico el 16 de Abr. de 2016
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 comentario
John D'Errico
John D'Errico el 16 de Abr. de 2016
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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by