How i can create one specific matrix 100X100?

 Réponse acceptée

Star Strider
Star Strider le 12 Jan 2015
Modifié(e) : Star Strider le 12 Jan 2015
This works:
v = -[1:100]';
vu = triu(repmat(v, 1, size(v,1)));
vl = tril(repmat(-v', size(v,1), 1));
out = vu + vl + diag(-v);

2 commentaires

Arhs
Arhs le 12 Jan 2015
Ty very much, it worked like a charm!!
Star Strider
Star Strider le 12 Jan 2015
My pleasure!

Connectez-vous pour commenter.

Plus de réponses (1)

kavya k
kavya k le 16 Mai 2017

0 votes

how to create a 240*320 matrix containing the data 0.1991 in all the cells.can anyone help me.

Catégories

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by