Write a function that accepts a string cell array and classify sort in ascending order according to the alphanumeric order (this Implies that you should treat 'A' and 'a' as the same letter) ?
15 次查看(过去 30 天)
显示 更早的评论
%%Program for alfanumerica
clear all; clc;
name = { } t = input('Enter the number of names you want:');
for i=1:t
name{i} = input('Enter the name you want:','s');
end
name = lower(name);
order = (name);
%%Result of the function
disp('The order described will be:');
disp(order);
These are my codes, but I have a problem when I write some words. For example : 'Yasar and yasar ' and the program , it turns my letters like these form ' yasar yasar' but I want that program needs to order my letters ' Yasar yasar' in this form consider the big letter. Please can you help me ? Kind Regards
0 个评论
回答(1 个)
Meet Vora
2021-11-16
clear all; clc;
name = {};
t = input('Enter the number of names you want:');
for i=1:t
name{i} = input('Enter the name you want:','s');
end
%order = (name);
[~,indices] = sort(lower(name));
%%Result of the function
display(names(indices));
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrices and Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!