MATLAB 2013a/b: stops responding when using UI for opening files during script execution - matlab

I've experienced under various setups that MATLAB stops responding when you try to open a file during script execution. Usually I'd just promptly kill MATLAB and start whatever I was doing before. However, now I'm working on a remote machine with a buggy OS interface that basically won't let me kill MATLAB. As the whole MATALB interface doesn't respond, I can't CTRL+C.
Is this a known issue and is there a workaround?

Related

Generally what would cause Unity Editor freezes and not responding?

I have encountered a critical issue that Unity Editor freezes. I've spent many hours debugging step by step of my codes but still can't find where the problem is. So I think maybe I should try thinking from another angle, generally speaking what reasons would cause Unity Editor freezes and not responding?
I can't find a general case discussion about this topic.
From my experience, infinite loop is one reason for sure. Deadlock is critical issue, but not sure if it causes Unity Editor freezes. Unity Editor bug that I encountered only makes the whole editor crashes, instead of freezing. Any other experiences are welcomed. Thank you!
In such case, what kind of tools or methods could I use to debug it? Right now since the editor freezes I can't use "print" to find out what happens after it freezes. So I use Visual studio to debug the Editor thread, in this way I can see all the prints that I wrote. It appears the game is still running, only the editor not responding. And I can use VS click "attach to Unity and play" and put some debugging points, then debug step by step.
The first thing that I would check out is for an infinite loop. At the hang/freeze moment, you can attatch the debugger of your choice and pause the execution. In the case that it is an infinite loop that it is executing, at the exec time pause you might find the execution in a forever running while (true) {...}
Other thing that I would check is the plugins in use. Several Unity plugins like Parse, FMOD, UMP (Universal Media Player), ZFBrowser, or Embedded Browser are using native threads. It’s an issue when a plugin ends up attaching a native thread to the runtime, which then does blocking calls to the OS. This means Unity can't interrupt that thread for the debugger (or domain reload) and hang. Source
To check that you can check the active threads in the visual studio command window af the freeze is reproduced:
View->OtherWindows->CommandWindow and type in this command:
Debug.ListCallStack /AllThreads /ShowExternalCode
In the stack you can check if some thread is there with no need, or if its related with the plugins mentioned above.
Also an interesting point is to check in the windows task manager (in the case that you are using windows) if the CPU usage is to 0%. It can lead you to the type of hang that is taking place.
Good luck.
Edit: I forgot to mention, you need to check also the unity logfiles
I notice this all the time, and its super frustrating.
Unfortunately, this could be any number of issues. I notice this issue most often when working in projects that are made for the Universal Windows Platform.
Try using the Task manager to monitor specific processes / threads running.
Some follow up questions:
What platform is your project currently targeting?
What version of Unity are you running? Have you tried other versions?
What are your computers specs? Is the OS up to date? Graphics Drivers?
Does it happen (or happen more often) when an external code editor is open? Perhaps try going to Preferences>External Editor > Regenerate Project files.
Are you using Unity Collab by chance? I've had issues where collab is stuck trying to communicate with Unity Servers / looking for changes. Try logging out of your Unity account through the editor, and log back in.
Have you tried looking for a Unity editor crash dump, or error log files? I think they can be found here C:\Users\username\AppData\LocalLow\Unity by default. Those files may give you more specific data concerning your problem.
Unity's new versions are getting more slower and slower. From my experience 2019 versions are the best and more stable.
I solved my issue. It's fundamentally an infinite loop.
It's not a simple case such as "while(true)". I'll try to explain.
My game was a PvP game, and I'm making a local AI. Usually my design pattern works fine, however I just turned off the simulation of "AI thinking time", and since the AI codes and server codes all run in local mode, the transmitting of data between server and client are replaced by local method call(meaning instantly executed before everything else).
There is a loophole in my server code. I use "Update" and a flag on server to change a specific game state, however in this particular case, it got into an infinite loop because the local method call is executed before the "Update". And because my AI now doesn't need real time to "think", it "acts" and transmits the event data to server right away. And since the transmitting doesn't need time any more, it calls the server method instantly, hence forming the infinite loop.

How do I figure out which extension or service is making a VS Code Helper process use 100% CPU?

Every so often the fans on my MacBook Pro start revving up and certain things in VS Code stop working, such as indentation and autocomplete etc.
When this happens I use Alfred App to figure out which process is causing an issue and it's usually one or more of the Code Helper processes launched by VS Code. Sometimes they'll a couple of them using way over 100% of the CPU. I kill the processes and then VS Code prompts me that the extension host has quit and to restart it. Once I do that the extensions start working again as normal. And then the whole thing repeats, just not all the time. For instance I'm writing this message now and Code is fine and not doing anything.
I'm wondering how do I debug this and figure out whether it's Code itself or an Extension causing the issue? If so how do I find out which extension it is?
Process Explorer is builtin in vscode.
It can be opened using menu by going Help => Open Process Explorer

How can I draw a MATLAB figure in a minimized Windows RDP session?

I have a script that generates a slew of figures for a manuscript. It crawls through a directory, loads in some data files, performs some calculations, formats the results into some figures and then outputs the figures to png and/or pdf files for inclusion into my manuscript using export_fig.
My problem is that the "performs some calculations" part is slow, and my directory to crawl through is reasonably sized. I would like to run the script on another machine so I can be getting other work done on my regular desktop machine. However, when I remote desktop into the other machine (between two Windows 7 Enterprise machines), as soon as I set things to run and minimize the RDP window, MATLAB throws the following error:
Error using drawnow
UIJ_AreThereWindowShowsPending - timeout waiting for window to show up
Clearly, the fact that there is no window for MATLAB to draw to is causing it problems. However, I have run this script overnight before, where the lock screen takes over, and not had a problem.
My question is, is there a way to tell MATLAB to draw the figure even if the display is a minimized RDP window, or do I have to physically log onto the computer to generate the figures?

How to change Matlab settings (for history.m) in terminal?

I am using Matlab on a remote server from my MacBook. Partly because I find the Matlab GUI clunky under X11, I use it in the terminal window (by running matlab -nodesktop). This has been working fine, until I now needed to copy some stuff from the command history.
It seems like history.m is only being saved on exit, even though when I check the settings in the GUI, it says that it is being saved for each command. It also seems like exit statements are included in history.m when Matlab is run from terminal, but not in the GUI, so it seems like the settings in the GUI don't apply there. I cannot find anything in the Matlab help pages on how to change the settings for the terminal window.
I need to access the command history for my session while it is still open. Does anybody have an idea about how I can do this -- short of starting to use the GUI?
You might try the diary function. It logs both commands and their (text based) results to a file. On my system (Mac OSX with MATLAB R2011b), the output does not show up in the diary file immediately, but it does update when you turn off the diary. Which you can do repeatedly if you need without exiting matlab.

Xming and picture rendering in Matlab

I'm using xming 6.9.0.31 on Windows XP computer to connect to Linux server and run Matlab scripts there. I have 2 configurations of xming and both have problems related to matlab output figures.
In one configuration everything works on the first script run, all figures come fine. But on the second run (of the same script) xming crashes when it outputs some figures. It might work longer if i create figures in command line, but eventually it will crash anyway, on the process of outputting new figure.
In another configuration (borrowed from andLinux installation) xming doesn't crash and is able to output figures, but only simple plots, if there is something more complicated, with a lot of data, just figure frame appears with whatever was under the figure window. The same thing happens if i actually run andLinux and connect to Matlab from there.
Seems that this is somehow related to memory. Are there any options for xming which are related to used memory? As far as i understand it'a only showing the image which was created on the server side?
If the issue is related to OpenGl setting another renderer might help.
set(gcf,'Renderer','Zbuffer')