how can i replce numbers at the end of rows and coloumns in same metrix?
1 次查看(过去 30 天)
显示 更早的评论
A=zeros(4) and i want to replce numbers at the end of 3rd,4th row and 3rd,4th coloumns. how can i do this?
1 个评论
Dennie
2015-10-7
A=zeros(4);
%replace 3rd row
A(3,:)=[1 2 3 4];
%replace 3rd column
A(:,3)=[1;2;3;4];
回答(1 个)
Titus Edelhofer
2015-10-7
Hi,
replacing is a question of indexing. Try
A(3:4, 3:4)
and you should see a 2x2 Matrix. Replace this by any other 2x2 matrix using =
A(3:4,3:4) = rand(2,2);
Titus
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!