Close a specific text file, while leaving different text files open (MatLab R2011b)
16 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Michael Jarboe
am 23 Dez. 2015
Kommentiert: Steven Lord
am 3 Feb. 2018
I am trying to close 1 of 4 open text files (leaving the other 3 open). I referred to the website above 'fclose'. When I try and close the file using: fclose(myfileid) the following error is shown "Error using fclose String argument must be 'all'"
fclose('all') works for closing ALL files but I NEED to keep the other 3 files open. Is this because I am working with an other version of MatLab? (R2011b) If so is there a workaround?
>> x = 'Cycle_HS1.txt'
x =
Cycle_HS1.txt
>> fopen(x)
ans =
3
>> fclose(x) Error using fclose String argument must be 'all'.
>> fclose('all')
ans =
0
0 Kommentare
Akzeptierte Antwort
Michael Jarboe
am 23 Dez. 2015
Bearbeitet: Michael Jarboe
am 23 Dez. 2015
2 Kommentare
Jerin Joseph Koshy
am 3 Feb. 2018
x = 'Cycle_HS1.txt'; y = fopen(x) i am getting y=-1????? can u pls tell me the reason??????
Steven Lord
am 3 Feb. 2018
Call fopen with two outputs. When the first output is -1, read the message in the second output for more information about why MATLAB was unable to open the file.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!