MATLAB Answers

why always fopen fails?

15 views (last 30 days)
Aniya
Aniya on 22 Oct 2016
Answered: Jan on 22 Oct 2016
in_file = fopen('name_of_file', 'wt');
It is my code i used to open a file .but it always return file identifier as -1.Why? Thank you for help.

  0 Comments

Sign in to comment.

Accepted Answer

Jan
Jan on 22 Oct 2016
Most likely you do not have write permissions in the current folder. Use a folder with write permissions and absolute file names:
in_file = fopen(fullfile(tempdir, 'name_of_file'), 'wt');

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.