How to check exist by function if a particular file to another folder in the directory ?

2 views (last 30 days)
Hello,
I would like to know how you could use the exist function to check whether a particular file in another folder or directory because of the way I do it gives me error and do not know if I 'm doing it right ... I could you help ?
matlab_dir = [ pwd filesep ] ;
cp = [ matlab_dir 'lib / '] ; % lib is the folder where the .wav files that I want to see if there are .
exist ( { [ cp ' example.wav '] , matlab_dir } )
thanks in advanced!
Undefined function ' exist ' for input arguments of type ' cell' .
  1 Comment
Karan Gill
Karan Gill on 6 Jul 2016
Edited: Karan Gill on 6 Jul 2016
The curly brackets {} convert your input to a cell array. exist does not accept cell array input so you get an error. Instead, follow the syntax on the doc page: http://www.mathworks.com/help/matlab/ref/exist.html .

Sign in to comment.

Answers (0)

Categories

Find more on File Operations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!