How to load a .mat file from the parent directory?
    16 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Mr M.
      
 am 19 Mai 2015
  
    
    
    
    
    Bearbeitet: Stephen23
      
      
 am 25 Jul. 2025
            How to load a file which is in the parent directory of the running script?
0 Kommentare
Akzeptierte Antwort
  Joseph Cheng
      
 am 19 Mai 2015
        
      Bearbeitet: Joseph Cheng
      
 am 19 Mai 2015
  
      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))
0 Kommentare
Siehe auch
Kategorien
				Mehr zu File Operations finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!