MATLAB: How to load a .mat file from the parent directory directoryloadrun How to load a file which is in the parent directory of the running script? Best Answer you can determine your current directory with pwd.so to load the file it'll go something like this myfile = 'mymatfile.mat'; [parentdir,~,~]=fileparts(pwd); load(fullfile(parentdir,myfile)) Related SolutionsMATLAB: Remove temporary install directory After installation, you can delete _temp_matlab_R2015b_win64. MATLAB: Load .mat file from anyfolder load C:\myFolder\mySubFolder\myMatFile.matorvariableName= 'myVarName';matfilePath = 'C:\myFolder\mySubFolder\myMatFile.mat';data = load(matfilePath);% to access the variabledata.(variableName); Related QuestionHow to create a directoryLoad a file by using a string in which the filename is storedUsing dir() without changing directory
Best Answer