Changing variables in Array
5 次查看(过去 30 天)
显示 更早的评论
Hello,
I want to creat an 2D Array with two rows and 7 columns. When this Array is full, I want the second account to replace the first one, the 3rd the second and so on.... The 7th should be replaced by a new account. Can you give me an Idea how to do this?
Best regards
0 个评论
采纳的回答
Roger Stafford
2013-11-29
I am guessing that by "account" here you actually mean "column". Is that correct? If so, with your 2D matrix called M and a new 2 x 1 "account" (column vector) called b, do this:
M = [M(:,2:end),b];
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!