If-statement = true then replace column with specfic value - How to?
Mostrar comentarios más antiguos
Hey
I'm trying to replace a whole column with a specific value if the number already appears in the column
Any suggestions?
My current output is the same as the input except for the one space where -3 appears it replaces it with 0 for some reason
m = size(input, 1);
n = size(input, 2);
for i = 1:n
for j = 1:m
if (input(i,j) == -3)
inputTemp(i,:) = -3;
i = i + 1;
else
inputTemp(i,j)= input(i,j);
end
end
end
2 comentarios
infinity
el 25 de Jun. de 2019
Hello,
Why do you put
i = i + 1;
in your code?
Tobias Skovgaard
el 25 de Jun. de 2019
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Introduction to Installation and Licensing en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!