フィルターのクリア

How to change directory or folder in Matlab in a program?

1 回表示 (過去 30 日間)
Mario Martos
Mario Martos 2016 年 7 月 6 日
編集済み: Stephen23 2016 年 7 月 6 日
Hello, I wanted to know how I can change to another folder in the same directory while I program . That is, I'm in a folder called ' first' for example, that is where my .m file 'm programming , and inside that folder there is another called ' second ' in which I want to place me in the program to check for certain files or anything . How could I?
In short , to have something like this:
function [ ] = main ( ) % that is in the main folder or directory % This program would other lines .
% And then go to the folder ' second '
if exist ( .wav file ) ~ = 2 % Within that folder to see if there is , then go back to the source folder .
Thanks in advanced!
  1 件のコメント
Stephen23
Stephen23 2016 年 7 月 6 日
編集済み: Stephen23 2016 年 7 月 6 日
It is possible to change folders, but doing this is slow and makes debugging difficult, and it is usually a bad way to write code. It is much faster and more reliable to simply pass the path information along with the file name. See Azzi Abdelmalek's answer for an example of this.

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

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 7 月 6 日
file=fullfile('second','*.wav')

その他の回答 (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