Error using fread Invalid file identifier. Use fopen to generate a valid file identifier.
조회 수: 13 (최근 30일)
이전 댓글 표시
hi im trying to create this code for one of my assesments and for some reason it kkeeps coming up with this message im pretty sure everything else is correct btu i cant find whats causing the errror mesage above.
my code and one of the files its meant to read from is included
댓글 수: 0
채택된 답변
Stephen23
2020년 6월 5일
편집: Stephen23
2020년 6월 5일
The problem is that your code only uses the filename, but you need to also provide the filepath (otherwise how does MATLAB know where the file is saved?). The filepath is provided as the second output of uigetfile:
[F,P] = uigetfile();
Results1 = fullfile(P,F);
Important: you should fclose every file that you fopen, otherwise your code will just collect more and more handles to open files, which can eventually cause various problems (errors, unresponsive, etc.)
Tip: you should name your variable with something more descriptive, i.e. that actually reflects their content and type.
추가 답변 (1개)
N___e
2020년 6월 5일
Strip command only strip a single character.
stripCharacter — Character to strip from input text
' ' (default) | character | string
Character to strip from input text, specified as a character or as a string that contains one character.
You can use the erase command,
It can match the string you want to erase.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Dates and Time에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!