How do I add a column to a matrix with specific values?
1 次查看(过去 30 天)
显示 更早的评论
If I have a matrix like so:
1 2 3 4
5 2 6 7
3 6 5 7
How can I add a third column with a value of one for every row that has a value of 2 in the second column? Thanks!
0 个评论
采纳的回答
更多回答(1 个)
Greg Heath
2013-7-10
The question is ill posed.
The matrix has 4 columns and the question is how to add a third column.
The accepted answer is incorrect.
It replaces components in the fourth column
1. Bad question
2. Bad answer.
It should be flagged.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!