MATLAB: How to judge “load” function load Hi guys: Is there a way to judge whether a '.txt' file could be loaded by "load" function? Some of my files are matrix which could be loaded by "load" but some are not. Is there a way to separate them? Thanks a lot Best Answer You could perform the load in a try/catch block and react accordingly: try load(filename); catch e % Something went wrong -- not a valid file to load? end Related SolutionsMATLAB: MAT files p=load matfile1.matq=load matfile2.matsave newmatfile.mat MATLAB: Where does “load” look for files What about using this syntax.load('./myfile.mat') Related QuestionLoad variable from mat fileDifference between “imread” and “load” an imageHow to judge a array is dlarray in matlabExclude a keyword from a file searchThe error using “load” and “fgets” codes in MATLAB 2013a
Best Answer