If-statement = true then replace column with specfic value - How to?
Show older comments
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 Comments
infinity
on 25 Jun 2019
Hello,
Why do you put
i = i + 1;
in your code?
Tobias Skovgaard
on 25 Jun 2019
Accepted Answer
More Answers (0)
Categories
Find more on Introduction to Installation and Licensing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!