How do I suppress a window opened by a Matlab function?

Hi! I am running the mdf function of vehicle network toolbox to batch-process mdf files. Each time a file is opened, several load screens are popping up to show the load progress. This takes only some miliseconds, but the OS (win7) focuses on each load screen - in effect, the PC is blocked as long as files are read (several times a second for up to 20 minutes) because the focus is permanently reset to the popups. I did not find an option in the mdf function itself to switch to some kind of silent mode.

2 commentaires

Pista Lele
Pista Lele le 8 Déc 2017
Modifié(e) : Pista Lele le 8 Déc 2017
I'm doing exactly the same thing and I have the same issue. Couldn't solve it so far.
Too bad (-_-)

Connectez-vous pour commenter.

 Réponse acceptée

Try adding a function on your path:
function wb = waitbar(varargin)
if nargout > 0
wb = matlab.graphics.GraphicsPlaceholder;
end
provided you are using R2014b or later. If you are using an earlier version, then the function needs to be made more complex, as waitbar() needs to return a graphics handle that can later be delete()'d

7 commentaires

Works like A CHARM! awesome, thx!
Thanks a lot for your answer! And sorry, but I do not understand how to implement it, however. Suppose my code consists only of:
mdfFileObj = mdf(currentFilePath);
How would I suppress the windows that now come up? Trying
mdfFileObj = waitbar(mdf(currentFilePath));
and adding the function as you wrote above in the code does not work out since I need to have a 1x1 MDF output type.
"Each time a file is opened, several load screens are popping up to show the load progress. "
It is not clear what those screens looked like. I guessed that they were places the code called waitbar() to show progress. In such a case you would just put the waitbar code I showed onto your path before starting the model.
Jan
Jan le 12 Déc 2017
I do not have the Vehicle Network Toolbox and cannot check, if "mdf" is provided as M-File. But if it is, you can examine its code to find out, where the windows are created and most likely suppress this easily.
Walter's idea is based on the assumption, that the "load screens" are waitbars. Then creating a pseudo-function called waitbar in the same folder, which does nothing, would shadow the original waitbar function.
Thank you for the helpful explanation!
I actually had looked for the function code before and found it, but it contains only a few lines of code and links to another function asam.MDF - this one is a .p file and I seem to have no way to access it. I found other function scripts that might be called by asam.MDF and cause the windows to pop up, but all are protected as .p
@Frank: If the windows are opened from P-functions, you cannot suppress their creation directly. It might work, if you shadow the corresponding built-in function: create figure.m inside the folder of the P-file and let it create an invisible figure:
function H = figure(varargin)
H = figure(varargin{:}, 'Visible', 'off');
end
But this is near to hacking and can have evil side-effects.
@Jan: Thank you, but that did have no effect as well. I'll contact the technical support for the vehicle network toolbox and ask them if there is any chance to deactivate this.
Thanks again to everybody for their help, I learned a lot!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Environment and Settings dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by