I created a zeros (n+1 by n+1) matrix. And I want the value 2*i on the row (2 : n)&(column 1:n-1) , where i is from 1 to n-1, how should I get that? Can anyone help me out?
Afficher commentaires plus anciens
I tried this :
n=4;
A=zeros(n+1);
for i=2:n-1
A([2:n,2:n-1])=[2*i]
end
But it didnt work
2 commentaires
Roger Stafford
le 19 Avr 2017
Modifié(e) : Roger Stafford
le 19 Avr 2017
Your statement isn’t clear to me. Could you give a specific example of what you want A to be with, say, n = 4.
Réponse acceptée
Plus de réponses (1)
Catégories
En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!