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)).
size(fread(fid))
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