hi, I have array a = [5 4 0;3 1 0;5 7 0], how can I replace the value in third column (a(:,3)) with the values in column 1 (a(:,1)) when a(:,1) > a(:,2) . I need obtain [5 3,5] in the third column
Show older comments
Accepted Answer
More Answers (1)
Gareth Lee
on 21 Oct 2016
Edited: Gareth Lee
on 21 Oct 2016
I think the description of your question is not clear, a(:,1)>a(:,2) is a column vector not all true. Is this your judge condition?
if all(a(:,1)>a(:,2))
a(:,3)=a(:,1);
end
Is this that your want ?
3 Comments
julios
on 21 Oct 2016
Gareth Lee
on 21 Oct 2016
Since my answer is right, please vote it even though you accept another answer.
julios
on 22 Oct 2016
Categories
Find more on Argument Definitions 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!