[message,errnum]
= ferror(fileID)
returns the error number that is associated with the error message.
[message,errnum] = ferror(fileID,'clear')
clears the error indicator for the specified file. Specify the literal
clear as a character vector or a string scalar. When you
clear the error indicator, succeeding calls to ferror behave as
if the most recent I/O operation is successful.
Return the details for the most recent file I/O error on a file that you specify.
Open the file to read.
fid = fopen('outages.csv','r');
Set the read position to -5 bytes from the beginning of the file. Since no data exists before the beginning of the file, fseek returns -1 indicating that the operation was unsuccessful.
status = fseek(fid,-5,'bof')
status =
-1
Get the details on the most recent error message on the file using its file identifier fid.
error = ferror(fid)
error =
'Offset is bad - before beginning-of-file.'
Error message, returned as character vector containing the error message
associated with the most recent I/O operation. If the most recent I/O
operation is successful or if you clear it manually, then
message is an empty character vector.
Error number, returned as an integer code associated with the error from
most recent file I/O operation. If the most recent file I/O operation is
successful, then errnum is 0. A
nonzero errnum indicates an error:
Negative values correspond to MATLAB® error messages.
Positive values correspond to C library error messages for
your system.
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.