how do we get adjacent values of an element in a 2D array matrix
    6 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    minion001
 am 9 Sep. 2017
  
    
    
    
    
    Kommentiert: Image Analyst
      
      
 am 11 Sep. 2017
            for example, the matrix is A[6 4 9 7 3 1; 4 8 1 9 3 8; 3 8 5 7 3 9; 8 2 4 6 3 7]
my current location is A[4,3]=4 and i want to get the adjacent elements [7;6] how would i write this code,
and also if i was at the location A[1,5]=3 how would i get the adjacent elements of it
thanks
0 Kommentare
Akzeptierte Antwort
  Image Analyst
      
      
 am 9 Sep. 2017
        I told you how in your duplicate post https://www.mathworks.com/matlabcentral/answers/355657-how-do-i-make-a-for-loop-picking-out-adjacent-values-of-an-2d-array#comment_482824
2 Kommentare
  Image Analyst
      
      
 am 11 Sep. 2017
				[rows, columns] = size(A)
for col = 1 : columns
    thisColumn = A(:, col);
    % Now do something with thisColumn......
end
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Simscape Electrical finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

