directory - How to read this line in MATLAB? -
i came across following lines in matlab
:
m = dir(fullfile(dataset,'*.png')); m = {m(~[m.isdir]).name};
i understand first line trying obtain .png
files directory. but, second line trying perform? isdir
seems determine input directory. that's new part. but, line trying perform?
thanks.
the second line getting files not directory , getting respective names , storing them cell array
m.isdir
indicates if folder or not- returns 1 if is, 0 if not.
~[m.isdir]
indicate of values returnedisdir
0.m(~[m.isdir])
grabs objects in m determined logical indexing done abovem(~[m.isdir]).name
gets names of of them{m(~[m.isdir]).name}
stores them in cell array
hopefully step step walkthrough helps.
while not sure why second line necessary because fullfile(dataset,'*.png')
should return paths end in .png
, not folder, guess check.
Comments
Post a Comment