How do I form a matrix from an array of rows and columns
1 次查看(过去 30 天)
显示 更早的评论
A=ones(10)
a=[1 3 5 6 9]
b=[1 2 4 7 9]
A(a,b)=0 should provide A(1,1)=0 A(3,2)=0 A(5,4)=0 A(6,7)=0 A(9,9)=0
0 个评论
采纳的回答
更多回答(1 个)
madhan ravi
2023-11-19
A(a + (b-1)*size(A,1)) = 0
1 个评论
madhan ravi
2023-11-19
编辑:madhan ravi
2023-11-19
A=ones(10);
a=[1 3 5 6 9];
b=[1 2 4 7 9];
A(a + (b-1)*size(A,1)) = 0
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!