Accessing the folder in Parent Directory

119 ビュー (過去 30 日間)
Bless
Bless 2013 年 2 月 23 日
コメント済み: James Morrison 2021 年 5 月 10 日
Help me to access folder in the parent directory. suppose I have 2 folders
E:\Bless\Project\LEARNING\myFolder\var.mat
E:\Bless\Project\TESTING\myPgm.m
I have to load a variable from the folder "myFolder" througn the myPgm.m program. Now I specify the entire path in
load "E:\Bless\Project\LEARNING\myFolder\var"
Is there any simple way to specify the path of var.mat?

採用された回答

Shashank Prasanna
Shashank Prasanna 2013 年 2 月 23 日
If you are in: E:\Bless\Project\TESTING\
You can try the following without using the absolute path:
load('..\LEARNING\myFolder\var.mat')
If the folders are in the path then you can do the following:
>> load(which('var.mat'))
  1 件のコメント
James Morrison
James Morrison 2021 年 5 月 10 日
Rather, use
load('.\LEARNING\myfolder\var.mat')
This allowed me to skip to my current directory. The ../ did not work. Do not use the which() function unless all your files have unique names!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSearch Path についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by