Assigning count values to the column of a matrix
3 次查看(过去 30 天)
显示 更早的评论
Hello,
I have a matrix A with the size 29x3 and I want to fill third column with the numbers from 29(the max lenght) to 1.
Is there a possible way to do it without using loops?
Regards
0 个评论
采纳的回答
Stephen23
2019-1-27
Either one of these, depending on the order that you want:
A(:,3) = 1:29
A(:,3) = 29:-1:1
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!