Error using fprintf Invalid file identifier. Use fopen to generate a valid file identifier.

2 ビュー (過去 30 日間)
Hello, I tried using fprint in different programms also examples, nothing worked.
Wath can i do if my fileID is -1 and using the full path does not work either.
this are my fileattributes
archive: 0
system: 0
hidden: 0
directory: 1
UserRead: 1
UserWrite: 1
UserExecute: 1
GroupRead: NaN
GroupWrite: NaN
GroupExecute: NaN
OtherRead: NaN
OtherWrite: NaN
OtherExecute: NaN
I dont know wath to do, please help ?

採用された回答

Walter Roberson
Walter Roberson 2020 年 11 月 12 日
directory: 1
That tells us that you have named a folder (directory) rather than a file or device name.
GroupRead: NaN
That tells us that you are using MS WIndows rather than MacOS or Linux.
On MS Windows, it is not permitted to fopen() a directory.
(It is not permitted on MacOS either, but historically it used to be possible on old versions of Unix; you would get out the internal binary representation of the directory.)
You will need to change your path so that you are naming a file rather than a directory.
  4 件のコメント
Lorenz Untersulzner
Lorenz Untersulzner 2020 年 11 月 12 日
It worked if i dont specify the file (.txt)
thanks very much !
Walter Roberson
Walter Roberson 2020 年 11 月 12 日
What was the message that was produced?
I suspect you have an existing Protocol.txt that you cannot write to.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLow-Level File I/O についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by