Problem with fprintf - invalid file intentifier

조회 수: 3 (최근 30일)
Mohamed Imbaby
Mohamed Imbaby 2019년 2월 7일
댓글: Mohamed Imbaby 2019년 2월 8일
So i have calculated some variables (X and Y) and i'm trying to insert them in a txt file. The .syn extension is for the exercise that i have. The error tham i'm getting is : Invalid file identifier. Use fopen to generate a valid file identifier. Anyone knows what's wrong?
Καταγραφή.PNG

채택된 답변

Walter Roberson
Walter Roberson 2019년 2월 7일
The filename you construct from the user's input together with the suffix .syn names a file that is not present in the current directory or anywhere on the MATLAB path and the user did not provide an appropriate path as part of their input.
This could for example happen if the user already provided the .syn extension. You always add a .syn extension so you could end up with NAME.syn.syn
  댓글 수: 2
Mohamed Imbaby
Mohamed Imbaby 2019년 2월 8일
Yes, when i'm running the code i put only the name of the file without the extension .syn and the problem that i wrote before occurs. For the directory i have created a folder where i store all the files of the problem and the text with the .syn extension that i created. Should i provide the path of the file that i created with a different way? Any idea on how to do it? Thank you in advance.
Mohamed Imbaby
Mohamed Imbaby 2019년 2월 8일
You were right, the direction was wrong and i changed it and it works! Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 File Compression에 대해 자세히 알아보기

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by