Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
how can i determine whether a matrix of any size is sorted or not (by rows and by columns)?
    6 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
suppose i have A = [1 2 3 4; 5 6 7 8] is sorted
but A = [1 2 3 4; 5 6 8 7] is not
diff(A) returns "1"-s mtrix if columns are sorted
0 comentarios
Respuestas (2)
  Azzi Abdelmalek
      
      
 el 6 de Dic. de 2012
        
      Editada: Azzi Abdelmalek
      
      
 el 6 de Dic. de 2012
  
      out1=all(arrayfun(@(x) issorted(A(x,:)),1:size(A,1)))   % by rows
out2=all(arrayfun(@(x) issorted(A(:,x)),1:size(A,2)))   % by columns
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!


