problem in fscanf with reading the data

1 Ansicht (letzte 30 Tage)
Rutika Titre
Rutika Titre am 30 Dez. 2015
Kommentiert: Rutika Titre am 31 Dez. 2015
I have a text file fidr = fopen('..\source\real_input.txt','r'); and I have used xreali=fscanf(fidr,'%d'); to read it. fidr contains '-1'. My error is Error using fscanf Invalid file identifier. Use fopen to generate a valid file identifier. Error in line xreali=fscanf(fidr,'%d'); Thank you!

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 30 Dez. 2015
The problem is in your fopen(). That filename was not found, or you did not have permission to open the file. You can get more information by using the two-output version of fopen:
[fidr, status] = fopen('..\source\real_input.txt', 'r');
if fidr < 0
fprintf(2, 'fopen failed because %s', status);
end
  1 Kommentar
Rutika Titre
Rutika Titre am 31 Dez. 2015
Hello Sir, Thank u for your answer. I had got its solution it was a very silly mistake I had made. Thank You!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Low-Level File I/O finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by