I have to create a matrix using only zeros, ones and eye
Show older comments
This is the matrix:
1 1 1 1 1
0 1 0 0 0
0 0 1 0 0
0 0 0 1 0
0 0 0 0 1
so far I wrote B=ones(1,5); C=eye(4,5); A=[B;C]
But this command didn't come out right. Can someone please help me.
Accepted Answer
More Answers (1)
Rob Purser
on 21 Jan 2019
0 votes
A = eye(5);
A(1,:) = ones(1,5);
Categories
Find more on Startup and Shutdown 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!