MATLAB Answers

How to solve error with data file

30 views (last 30 days)
Sohyeon Jeon
Sohyeon Jeon on 15 Oct 2018
Edited: Sohyeon Jeon on 4 Jul 2020
I have a problem with the date files I've acquired from an audio-visual experiment.
audios = [0 1 2 1 2];
modes = [0 1 1 2 2];
DataFile = ls('a.mat','b.mat','c.mat','d.mat','sample.mat');
nRun = size(DataFile, 1);
I get error sign like this.
Error: AVtranslate_practice (line 11) S = load(deblank(DataFile(df,1:nRun)), 'gvals');
and that it cannot find the directory and files. Could you help me out on this problem?

  1 Comment

KSSV on 15 Oct 2018
Check whether the file name created is existing in the current working directory.

Sign in to comment.

Accepted Answer

madhan ravi
madhan ravi on 15 Oct 2018
Edited: madhan ravi on 15 Oct 2018


madhan ravi
madhan ravi on 15 Oct 2018
you‘re welcome you can also vote the answer :)

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 17 Oct 2018
What does ls() return? A cell array? A number.
Try this:
filename = deblank(DataFile(df, 1 : nRun))
fprintf('filename = %s\n', filename);
if exist(filename, 'file')
message = sprintf('%s exists!', filename);
message = sprintf('%s does not exist!', filename);
What do you observe?


Sign in to comment.


Community Treasure Hunt

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

Start Hunting!