why always fopen fails?

1 visualización (últimos 30 días)
Aniya
Aniya el 22 de Oct. de 2016
Respondida: Jan el 22 de Oct. de 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.

Respuesta aceptada

Jan
Jan el 22 de Oct. de 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');

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by