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

Post Reply
matlab1
Site Admin
Posts: 4797
Joined: Thu Dec 15, 2016 9:30 am
Contact:

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

Post by matlab1 »

The stream is already open and cannot be reopened. Please call ''close'' and try again
matlab1
Site Admin
Posts: 4797
Joined: Thu Dec 15, 2016 9:30 am
Contact:

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

Post 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


Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests