I have a matrix which size is mxm (square) variable and I wanna assign a mx1 matrix into the first matrix's diagonal. What kind of loop I have to write?
Show older comments
for example;
%m=matrix's row which is variable depends on the input
a=zeros(m)
b=[mx1]
I wanna assign b matrix into the a matrix's diagonal.
3 Comments
Azzi Abdelmalek
on 19 May 2013
Give a small example, and tell what should be the result
sermet
on 19 May 2013
Image Analyst
on 19 May 2013
I was going to suggest the cyclist's third method, which he posted before your comment above. Did you try it?
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices 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!