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 returned isdir 0.
  • m(~[m.isdir]) grabs objects in m determined logical indexing done above
  • m(~[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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -