How do you get the size of a file in MATLAB?

前端 未结 7 1855
耶瑟儿~
耶瑟儿~ 2020-12-09 07:36

What is the best way to figure out the size of a file using MATLAB? The first thought that comes to mind is size(fread(fid)).

7条回答
  •  渐次进展
    2020-12-09 08:14

    This code works for any file and directory (no need for absolute path) :

        dirInfo=dir(pwd);
        index = strcmp({dirInfo.name},[filename, '.ext']); % change the ext to proper extension 
        fileSize = dirInfo(index).bytes
    

提交回复
热议问题