clear all; clc; % test sorting dari cell M = cell(4,2); M{1,1} = 'mawar'; M{1,2} = 23; M{2,1} = 'Anggrek' ; M{2,2} = 11; M{3,1} = 'Durian'; M{3,2} = 45; M{4,1} = 'Benalu'; M{4,2} = 222; % sorting berdasarkan jarak N = sortrows(M,2); disp(M); disp(N); % output % 'mawar' [ 23] % 'Anggrek' [ 11] % 'Durian' [ 45] % 'Benalu' [222] % % 'Anggrek' [ 11] % 'mawar' [ 23] % 'Durian' [ 45] % 'Benalu' [222]
No comments:
Post a Comment