**WINDOWS only - must be compiled before use**
If you want to do some heavy processing and you don't want your computer to get all sluggish whilst it's going on, you can use this tool thusly:
pri=priority('l') % set priority to low
priority(pri) % set it back
2. It affects child processes for priorities at normal and below; not otherwise. This is intrinsic behaviour: http://goo.gl/d7b2Wg
Thanks for your interest in priority - still in my startup script 13 years later!
1. Does this still work (e.g. in 2015b? 2016a?)
2. Does this only affect the MATLAB process itself, or will it also affect any child process? (e.g. another program called via the "system" command?)
I wouldn't bet any money on it, but it looks like you might be compiling priority.cpp (which is C++) using a C compiler. I'd look at your mex setup options file and see if you can figure out why that's happening.
Hi. i wanted to test this, however priority compile fails.
Error priority.cpp: 59 illegal statement termination
Error priority.cpp: 59 skipping `char'
Error priority.cpp: 59 undeclared identifier `buf'
Error priority.cpp: 59 type error: pointer expected
Warning priority.cpp: 59 Statement has no effect
Error priority.cpp: 60 type error in argument 1 to `sprintf'; found `int' expected `pointer to char'
Error priority.cpp: 61 type error in argument 1 to `sprintf'; found `int' expected `pointer to char'
Error priority.cpp: 62 type error in argument 1 to `sprintf'; found `int' expected `pointer to char'
Error priority.cpp: 63 type error in argument 1 to `sprintf'; found `int' expected `pointer to char'
Error priority.cpp: 64 type error in argument 1 to `sprintf'; found `int' expected `pointer to char'
Error priority.cpp: 65 type error in argument 1 to `mxCreateString'; found `int' expected `pointer to const char'
Warning priority.cpp: 59 possible usage of buf before definition
Error priority.cpp: 76 illegal statement termination
Error priority.cpp: 76 skipping `int'
Error priority.cpp: 76 undeclared identifier `buflen'
Error priority.cpp: 77 illegal statement termination
Error priority.cpp: 77 skipping `char'
Error priority.cpp: 77 undeclared identifier `buf'
Error priority.cpp: 77 type error: pointer expected
Error priority.cpp: 77 operands of = have illegal types `int' and `pointer to char'
Error priority.cpp: 78 illegal statement termination
Error priority.cpp: 78 skipping `int'
Error priority.cpp: 78 too many errors
I've been using this for many years. It's a great little tool!
No, they don't. I've uploaded just source, then. Thanks anyway
Hmmm... do mathworks still allows us to upload binaries? I've a funny feeling they started outlawing that. We'll see, I just tried uploading a version with a win32 binary.
Ben: Got it solved. It wasn't Windows 7 that was the problem. Instead, I was on 64-bit Matlab R2010b and it wanted a 64-bit binary. Recompiled it with a "mex priority.cpp" and all was working.
Side note: it is now "mex -setup", not "mex setup" as is says in your readme. Also, do you want the priority.mexw64 binary so you can include it with the distribution? Happy to share it.
Works for me on Windows 7 - what's the problem?
Perhaps you need to be an Administrator to change process priorities? Can you change the priority using Task Manager?
Any ideas on how to get this working on Windows 7?
Works when I use your .dll, but I can't get the .c code to compile. I was hoping to alter your .c code to get maximum priority.
Been using this for 9 years every day as part of my startup script so that long-running MATLAB programs don't hog my computer. Thanks!
Good, but doesnt work on mine. I just cant set to above normal... win98 matlabR12.
good work! very useful!
Nice! Confirmed to work on win2k SP3.
Added self-compile option.
Updated to provide self-compile for platforms for which binaries are not supplied.
whoops - editor, please use this file, not the one i sent five mins ago :)
2008-09-19 V2 removed restriction on "h" (high) priority as requested
Added source code, and binary for R2007b (latter uses .NET).
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.