Page 1 of 1

The stream is already open and cannot be reopened. Please call ''close'' and try again

Posted: Thu Feb 09, 2017 2:16 pm
by matlab1
The stream is already open and cannot be reopened. Please call ''close'' and try again

Re: The stream is already open and cannot be reopened. Please call ''close'' and try again

Posted: Wed Jan 20, 2021 2:45 pm
by matlab1
Solution:

When you open a stream and try to open it again, you will see this error.

So check previous lines of your MATLAB code.


A = fread(fileID) reads data from an open binary file into column vector A and positions the file pointer at the end-of-file marker. The binary file is indicated by the file identifier, fileID. Use fopen to open the file and obtain the fileID value. When you finish reading, close the file by calling fclose(fileID).



fwrite(fileID,A) writes the elements of array A as 8-bit unsigned integers to a binary file in column order. The binary file is indicated by the file identifier, fileID. Use fopen to open the file and obtain the fileID value. When you finish writing, close the file by calling fclose(fileID).



For more information,
https://www.mathworks.com/help/matlab/ref/fwrite.html
https://www.mathworks.com/help/matlab/ref/fread.html