How to store the following Matrix in a variable?
2 views (last 30 days)
Show older comments
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 Comments
Accepted Answer
Walter Roberson
on 15 Sep 2022
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 Comments
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!