필터 지우기
필터 지우기

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
Shuangbiao Liu
Shuangbiao Liu 2023년 11월 11일
I have the same issue. Looking forward to having a solution.
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
  댓글 수: 1
engdancili
engdancili 2023년 9월 14일
Dear Ganesh,
thank you for your reply. I do have the correct version of MCR (9.13, R2022b). The issue has not been solved.

댓글을 달려면 로그인하십시오.

카테고리

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