How can I write MATRIX?
    9 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
When the programme run I must abtain below
matrix(1,2)=1; matrix(2,1)=1; matrix(1,3)=1; matrix(3,1)=1; matrix(2,3)=1; matrix(3,2)=1;
What can I write instead of question tag in the below matlab programme to obtain matrix(1,2)=1; matrix(2,1)=1; matrix(1,3)=1; matrix(3,1)=1; matrix(2,3)=1; matrix(3,2)=1; ?
%%%%%%%%%%%%%%%%%%%%%%%%%%% clc matrix=zeros(10,10); for i=1:? matrix(?,?) = 1; matrix(?,?) = 1; end
0 Commenti
Risposta accettata
  Anthony
      
 il 8 Lug 2014
        I am not sure to have understood your question but you should try:
M =1-eye(10);
By the way: avoid loops in Matlab ;-) Hope it helps,
0 Commenti
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Resizing and Reshaping Matrices in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

