- Technical Services and Consulting
- Embedded Systems | Firmware Developement | Simulations
- Electrical and Electronics Engineering
Can't use Excel while running MATLAB code in the background
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a problem regarding the utilization of Excel on Windows (Windows 10 Education) while a MATLAB code is running in the back.
My MATLAB-script (R2023b) analyzes data and creates figures in the background. Using other applications while the task is running works fine with every software except for Excel 2016 (from the Microsoft Office Professional Plus Package). When a new figure opens in MATLAB, it comes to the front and any keyboard inputs are directed to the MATLAB window. To use Excel in this scenario, the Excel window has to be selected every time that a new MATLAB figure has been created.
This problem does not occurr with any other Microsoft Office software.
Does anybody have an idea what causes this interference between MATLAB and Excel?
0 comentarios
Respuestas (2)
Hassaan
el 8 de En. de 2024
The behavior you're encountering, where MATLAB figures take focus away from Excel when they're created, could be due to MATLAB's default figure window behavior, which is to bring new figures to the front. This behavior isn't specific to Excel and can affect interaction with any other software. However, some users might notice it more with Excel due to the nature of their work.
set(0,'DefaultFigureCreateFcn','set(gcbf,''Visible'',''off'')');
set(0,'DefaultFigureVisible','off');
Add these lines at the beginning of your script. This sets the default figure creation function to make new figures invisible upon creation. After creating a figure and finishing your plotting commands, you can then make the figure visible:
figure;
% Your plotting commands here
set(gcf, 'Visible', 'on');
This should allow you to create figures without them popping up and stealing focus from Excel.
Another approach could be to batch process your data and then display all the figures at once after your computations are complete, minimizing interruptions during your work with Excel.
Remember, any changes to the default figure properties affect all figures created in the MATLAB session, so you might want to reset the defaults after your script is done if you expect standard behavior later in the session.
------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
Feel free to contact me.
0 comentarios
Ding Ding
el 29 de Oct. de 2024
I have the same problem when using Word with Matlab running in the back. This problem arose after I upgraded the OS from Win 10 to Win 11. If you have an extended screen, a workaround is to drag the Matlab figure window onto another screen, which will not interfere with the worksheet on the main screen.
0 comentarios
Ver también
Categorías
Más información sobre Spreadsheets en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!