How to sort uigetfile multiselect data output (cell datas) correctly?

4 views (last 30 days)
Tyann Hardyn
Tyann Hardyn on 16 Oct 2021
Hi, Community
I want to sort filename from uigetfile (multiselect) so that each file would be processed in sequence by that sort later...
Iam creating an uigetfile function like this :
[namafile,arah]=uigetfile({'*.txt', 'Text-Files (*.txt)'},'Load Extraction Data File', 'Multiselect','on');
full_ekstrak = fullfile(arah, namafile); %I dont know where is between these datas that can be used to sort each of filename data
nfiles = numel(full_ekstrak); %I dont know where is between these datas that can be used to sort each of filename data
namafiles_ekstrak = cellstr(sort(namafile)); %I dont know where is between these datas that can be used to sort each of filename data
f = cellstr(fullfile(arah,namafile)); %I dont know where is between these datas that can be used to sort each of filename data
file = length(f); %I dont know where is between these datas that can be used to sort each of filename data
and one of the output variable would be like this (multiselect data) :
namafiles_ekstrak'
ans =
3×1 cell array
{'Komponen Magnet Data Definitif IAGA Menitan (dmin) Periode 01-Nov-2017 Hingga 30-Nov-2017 Stasiun TUN.txt'}
{'Komponen Magnet Data Definitif IAGA Menitan (dmin) Periode 01-Oct-2017 Hingga 31-Oct-2017 Stasiun TUN.txt'}
{'Komponen Magnet Data Definitif IAGA Menitan (dmin) Periode 01-Sep-2017 Hingga 30-Sep-2017 Stasiun TUN.txt'}
Thats Not what i want to get from namafiles_ekstrak variable.
I just want to sort it as ;
{'Komponen Magnet Data Definitif IAGA Menitan (dmin) Periode 01-Sep-2017 Hingga 30-Sep-2017 Stasiun TUN.txt'}
{'Komponen Magnet Data Definitif IAGA Menitan (dmin) Periode 01-Oct-2017 Hingga 31-Oct-2017 Stasiun TUN.txt'}
{'Komponen Magnet Data Definitif IAGA Menitan (dmin) Periode 01-Nov-2017 Hingga 30-Nov-2017 Stasiun TUN.txt'}
So it would be sorted by the datetime IN each of cell output (cell matrix) like that.....
Would it be possible to sort cell matrix like that. I know, maybe its only a small problem and easy, BUT Anyone, please help me in finding this solution that is sooo difficult for me. Iam so grateful if anyone can help me out. Thank you so much /.\ /.\ /.\

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!