Failed to open file '...\mcr\t​oolbox\mat​lab\iofun\​@timer\tim​er.m'. Details: 'File stream is closed. The following flags are set: failbit.' when using plot in standalone exe

11 次查看(过去 30 天)
My standalone application (executable file on Windows 10) works well in performing a variety of task: reading and writing files, executing third party software, make computations, plot charts, log diary, move files, etc. I also need to show the console during execution as it reports a diary of the operations performed, warnings, and some output data.
The final output data are a few lines on the console and a plot. The console is intended to reproduce the same output of the MATLAB command window. However, any time the mouse pointer is hovering on the plot generated by the standalone executable, the command line throws a long sequence of errors:
Failed to open file 'C:\Program Files\MATLAB\MATLAB Runtime\R2022b\mcr\toolbox\matlab\iofun\@timer\timer.m'. Details: 'File stream is closed. The following flags are set: failbit.'
Failed to open file 'C:\Program Files\MATLAB\MATLAB Runtime\R2022b\mcr\toolbox\matlab\iofun\@timer\timer.m'. Details: 'File stream is closed. The following flags are set: failbit.'
Failed to open file 'C:\Program Files\MATLAB\MATLAB Runtime\R2022b\mcr\toolbox\matlab\iofun\@timer\timer.m'. Details: 'File stream is closed. The following flags are set: failbit.'
Warning: Error occurred while executing the listener callback for event WindowMouseMotion defined for class matlab.ui.Figure:
The file
"C:\Program Files\MATLAB\MATLAB Runtime\R2022b\mcr\toolbox\matlab\iofun\@timer\timer.m"
cannot be executed.
Error in matlab.graphics.interaction.actions.Linger/startTimer
Error in matlab.graphics.interaction.actions.Linger/motionCallback
Error in matlab.graphics.interaction.actions.Linger
> In waitforallfiguresclosed (line 20)
Failed to open file 'C:\Program Files\MATLAB\MATLAB Runtime\R2022b\mcr\toolbox\matlab\iofun\@timer\timer.m'. Details: 'File stream is closed. The following flags are set: failbit.'
Failed to open file 'C:\Program Files\MATLAB\MATLAB Runtime\R2022b\mcr\toolbox\matlab\iofun\@timer\timer.m'. Details: 'File stream is closed. The following flags are set: failbit.'
Failed to open file 'C:\Program Files\MATLAB\MATLAB Runtime\R2022b\mcr\toolbox\matlab\iofun\@timer\timer.m'. Details: 'File stream is closed. The following flags are set: failbit.'
Failed to open file 'C:\Program Files\MATLAB\MATLAB Runtime\R2022b\mcr\toolbox\matlab\iofun\@timer\timer.m'. Details: 'File stream is closed. The following flags are set: failbit.'
Failed to open file 'C:\Program Files\MATLAB\MATLAB Runtime\R2022b\mcr\toolbox\matlab\iofun\@timer\timer.m'. Details: 'File stream is closed. The following flags are set: failbit.'
Failed to open file 'C:\Program Files\MATLAB\MATLAB Runtime\R2022b\mcr\toolbox\matlab\iofun\@timer\timer.m'. Details: 'File stream is closed. The following flags are set: failbit.'
Failed to open file 'C:\Program Files\MATLAB\MATLAB Runtime\R2022b\mcr\toolbox\matlab\iofun\@timer\timer.m'. Details: 'File stream is closed. The following flags are set: failbit.'
Failed to open file 'C:\Program Files\MATLAB\MATLAB Runtime\R2022b\mcr\toolbox\matlab\iofun\@timer\timer.m'. Details: 'File stream is closed. The following flags are set: failbit.'
Failed to open file 'C:\Program Files\MATLAB\MATLAB Runtime\R2022b\mcr\toolbox\matlab\iofun\@timer\timer.m'. Details: 'File stream is closed. The following flags are set: failbit.'
Failed to open file 'C:\Program Files\MATLAB\MATLAB Runtime\R2022b\mcr\toolbox\matlab\iofun\@timer\timer.m'. Details: 'File stream is closed. The following flags are set: failbit.'
Failed to open file 'C:\Program Files\MATLAB\MATLAB Runtime\R2022b\mcr\toolbox\matlab\iofun\@timer\timer.m'. Details: 'File stream is closed. The following flags are set: failbit.'
Failed to open file 'C:\Program Files\MATLAB\MATLAB Runtime\R2022b\mcr\toolbox\matlab\iofun\@timer\timer.m'. Details: 'File stream is closed. The following flags are set: failbit.'
Warning: Error occurred while executing the listener callback for event ButtonExited defined for class matlab.graphics.primitive.canvas.JavaCanvas:
The file
"C:\Program Files\MATLAB\MATLAB Runtime\R2022b\mcr\toolbox\matlab\iofun\@timer\timer.m"
cannot be executed.
This happened on R2022b on different machines with Windows 10. The exe provides the same results of the MATLAB script and everything works fine, except for the errors reported above. I tried to disable the interactivity of the plot, avoid moving files, using a different type of the plot: the issue is always present.
Due to the complexity and the confidentiality of my work I will report a minimum and generic working example that provides the same issue. It is sufficient to generate the executable file of the following code with the Application Compiler:
close all; clearvars; clc
A = magic(5);
plot(A,'o-')
grid on
title('Call it magic')
with the additional runtime setting "Do not display the Windows Command Shell..." disabled. I get something like the following screenshot.
Any advice on how to solve?
  3 个评论
Eric Delgado
Eric Delgado 2024-5-5
Wow... I have the same issue, but in Matlab WebServer environment (which is supported by Matlab Runtime). :(
Hey guys, did you already open a request for service so MathWorks can respond to what is happening?

请先登录,再进行评论。

回答(1 个)

Ganesh
Ganesh 2023-9-14
The issue is non reproducible from my end, and may have to do with version mismatches of of MATLAB Runtime.
Kindly refer to this documentation for getting the appropriate version of MCR.
Feel free to reach out if the issue still persists.
Thanks and Regards,
Ganesh S

类别

Help CenterFile Exchange 中查找有关 MATLAB Compiler 的更多信息

产品


版本

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by