Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
how to change this code to search on column ?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
A=[ 0 0 1 0 1 0 1 4 1 0
10 10 6 5 1 1 1 5 6 10 ]
a=[ 10 10 7 5 2 1 2 9 7 10 ]
b = [1 1 2 1 2 1 2 2 2 1 ]
this code to row i want to change it for column
N = 10;
m = size(A,1);
% Pre-allocate the F_Complete matrix
F_Complete = zeros(m, N)
for i = 1:m
if a(i)+b(i)-1 == 10
tempVector = [ones(1,A(i,1)) 0 ones(1,A(i,2)) 0 ones(1,A(i,3))];
F_Complete(i,:) = tempVector(1:N);
end
end
to produce this solution
F_complete = [ 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 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 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 1 0 1
1 1 0 0 0 0 0 1 0 1
1 1 0 0 0 0 0 1 0 1 ]
2 comentarios
Image Analyst
el 30 de Abr. de 2016
Explain in words, what conditions would you like a column of F_complete to have a 1 at a particular row?
Respuestas (0)
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!