kilya

SortRows

Jan 20th, 2018
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.46 KB | None | 0 0
  1.  
  2. مثال
  3. A = [ 4 2 1; 6 7 1; 1 5 9];
  4. A1 = sortrows(A);
  5. النتيجة :
  6. A1 =
  7. 1     5      9
  8. 4     2      1
  9. 6     7      1
  10.  
  11. وإذا أردت ترتيب تنازلي لا تستعمل
  12. descend هكذا :
  13. A11 = sortrows(A,'descend');
  14.  
  15. بل استعمل
  16. A11 = sortrows(A,-1);
  17. أو
  18. A11 = sortrows(A,1,'descend')
  19.  
  20. وإذا أردت الترتيب حسب الصف الثاني أو الثالث تستعمل :
  21. A2 = sortrows(A,2);
  22. A3 = sortrows(A,3);
  23. ...
Advertisement
Add Comment
Please, Sign In to add comment