Code covered by the BSD License  

Highlights from
priority

4.8
4.8 | 5 ratings Rate this file 13 Downloads (last 30 days) File Size: 2.88 KB File ID: #1841

priority

by

Ben Mitch (view profile)

 

15 Jun 2002 (Updated )

Change the priority of the MATLAB Process programatically.

| Watch this File

File Information
Description

**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
<do processing>
priority(pri) % set it back

MATLAB release MATLAB 7.5 (R2007b)
Other requirements Win95 or WinNT 3.1 or greater. More options work with Win2000 or later.
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (14)
22 Oct 2014 Ben Mitch

Ben Mitch (view profile)

Hi Aleksander

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.

Cheers

Comment only
22 Oct 2014 Aleksander

Hi. i wanted to test this, however priority compile fails.

priority('compile')
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

Comment only
24 Nov 2010 Steve Hoelzer

Steve Hoelzer (view profile)

I've been using this for many years. It's a great little tool!

22 Nov 2010 Ben Mitch

Ben Mitch (view profile)

No, they don't. I've uploaded just source, then. Thanks anyway

Comment only
22 Nov 2010 Ben Mitch

Ben Mitch (view profile)

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.

Cheers

Comment only
22 Nov 2010 Alan

Alan (view profile)

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.

Comment only
20 Nov 2010 Ben Mitch

Ben Mitch (view profile)

Hi Alan

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?

Comment only
01 Nov 2010 Alan

Alan (view profile)

Any ideas on how to get this working on Windows 7?

Comment only
26 Jul 2009 Ian Nauhaus

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.

Comment only
08 Jun 2009 Alan

Alan (view profile)

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!

14 Feb 2006 Cleber Inacio

Good, but doesnt work on mine. I just cant set to above normal... win98 matlabR12.

14 Jul 2005 E Lehmann

good work! very useful!

26 Jun 2005 Y Mehta

Thanks,

It works

Comment only
31 Jan 2003 Ed Wilson

Nice! Confirmed to work on win2k SP3.

Updates
07 Apr 2009

Added source code, and binary for R2007b (latter uses .NET).

18 Sep 2009

2008-09-19 V2 removed restriction on "h" (high) priority as requested

18 Sep 2009

whoops - editor, please use this file, not the one i sent five mins ago :)

22 Nov 2010

Updated to provide self-compile for platforms for which binaries are not supplied.

22 Nov 2010

Added self-compile option.

Contact us