fopen problem using updated software

조회 수: 7 (최근 30일)
Kan Yao
Kan Yao 2017년 6월 27일
답변: Jan 2017년 6월 27일
I use fopen(fid,"w") in matlab 2015b in windows, the function works well. But as I switch to matlab 2017a in mac, student use.
I have the following error:
First Input must be a file name or a file identifier.
I am wondering what's wrong?
Thanks.
b
  댓글 수: 2
Walter Roberson
Walter Roberson 2017년 6월 27일
Please show more of your code including how you construct the variable "fid"
Note: it is quite common that the variable fid is used for a numeric file identifier returned from fopen(), rather than for the file name.
Question: are you reading the file name from a file using importdata() ?
Stephen23
Stephen23 2017년 6월 27일
@Kan Yao: please explain to us what fid is, or how it is created.

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

답변 (1개)

Jan
Jan 2017년 6월 27일
As the documentation and the error message explains, the standard calling is:
fid = fopen(FileName, 'w')
Here fid is a numerical file identifier and FileName is the string containing the name of the file.

카테고리

Help CenterFile Exchange에서 Large Files and Big Data에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by