How to store the following Matrix in a variable?
2 次查看(过去 30 天)
显示 更早的评论
How to store the following Matrix in the variable C?
I got the following error
M = ones(7);
C = M(logical(eye(7))) = 0.4
0 个评论
采纳的回答
Walter Roberson
2022-9-15
M = ones(7);
C = M;
C(logical(eye(7))) = 0.4
%or
M = ones(7);
C = M;
C(1:size(C,1)+1:end) = 0.4
%or
M = ones(7);
C = M - 0.6 * eye(size(M))
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!