Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
how to solve loops conditions ??
    7 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
any one can help me for this homeworke i couldnt solve
use loops or/and Condition statements to creat this matrix
   1   2  3  4  5
   6   7  8  9  10 
A= 11 12 13  14 15
   16 17 18  19 20
   21 22 23  24 25
   26 27 28  29 30
0 comentarios
Respuestas (2)
  Walter Roberson
      
      
 el 20 de Abr. de 2013
        for K = 1 : 1
  A = reshape( 1:30, 5, 6 ) .';
end
1 comentario
  Ahmed A. Selman
      
 el 21 de Abr. de 2013
				
      Editada: Ahmed A. Selman
      
 el 21 de Abr. de 2013
  
			What is for k = 1 : 1 doing here, when it's from 1 to 1 and A is k independent?
  Ahmed A. Selman
      
 el 21 de Abr. de 2013
        #1) Using for loops only:
clear
k=0;
for i=1:6
    for j=1:5
    k=k+1;
    A(i,j)=k;
    end 
end 
disp(A)
#2) Using for loop with if statement:
clear 
clc
k=0;
j=1;
for i=1:30
    k=k+1;
    A(j,k)=i;
    if fix(i/5)==(i/5)
        j=j+1;
        k=0;
    end 
end 
disp(A)
0 comentarios
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


