Info
此问题已关闭。 请重新打开它进行编辑或回答。
A question about generating a matrix
1 次查看(过去 30 天)
显示 更早的评论
If I want to have a matirx which follows the change of n, says when n=2, A=[0 1] when n=3,A=[0 0 1], n=5, A=[0 0 0 0 1]. How can I achieve this goal using code? Thank you.
0 个评论
回答(1 个)
Bruno Luong
2018-10-11
clear A
A(n) = 1
2 个评论
Bruno Luong
2018-10-11
编辑:Bruno Luong
2018-10-11
Presumably you want "0" and not "o", add the following
A=A(:)
or
clear A
A(n,1) = 1
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!