Alphabetical Sorting (case insensitive)
Heyy everyone, Having small issue with my code, where i want to assort an array of words in alphabetical order (with specific case insensitive sorting). My code is;
A = ["help" ; "MATLAB" ; "anyTIME" ; "matrix" ; "alGEBra"];
[M,N]=size(A);
for i = 2:N
char = A(i,:);
j = i-1;
A_j=A(j+1,:);
A(n+1:i)=A_j(A_j>char);
j=j-max(A_th);
A(j+1,:) = char;end disp(A);
it assorts the words, but not correctly. I can successfully do this sorting with numbers no problem. And i can sort the words alphabetically with the output case sensitive(have a couple different codes but wont attach them coz i dont want to bore you lovely people). but getting the output as alphabetical AND case insensitive is proving much more problematic (NOTE: i know you could use the sort function, but i want to do it with this one for loop). Any help is much appreciated <3
1 commentaire
Réponses (2)
1 commentaire
Catégories
En savoir plus sur Shifting and Sorting Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!