5.0 | 2 ratings Rate this file 11 Downloads (last 30 days) File Size: 2.29 KB File ID: #36194 Version: 1.1

Insomnia: prevent computer sleep mode



16 Apr 2012 (Updated )

This small utility prevents, on Windows computers, the automatic sleep mode.

| Watch this File

File Information

This small utility prevents, on Windows computers, the automatic sleep mode often activated by "aggressive" power policies.

Preventing computer sleep mode (a.k.a "power save") is mostly useful while doing long computations in a MATLAB script.

This utility has been inspired by the original INSOMNIA Windows utility!
See http://blogs.msdn.com/b/delay/archive/2009/09/30/give-your-computer-insomnia-free-tool-and-source-code-to-temporarily-prevent-a-machine-from-going-to-sleep.aspx

Required Products MATLAB
MATLAB release MATLAB 7.11 (R2010b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (9)
22 Sep 2015 Alvaro Duran Martinez

Good job but not working for me. Instead, I use the following commands at the begining and at the end of my script:

At the begining:

% Inhibit computer from going to sleep

system('powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c');

At the end:

% Allow computer to go to sleep

system('powercfg -setactive 381b4222-f694-41f0-9685-ff5bb260df2e');

The GUID used in each case is different on each computer. It can be queried by typing 'powercfg -list' on a command line window. There is a GUID for each energy mode, just choose the ones that allow or prevent the computer from going to sleep mode.

27 Jul 2014 Francesco Montorsi

Hi Parth! unfortunately it is much harder to create an "insomnia" tool for Linux... the closest thing I could found is "Caffeine":
but it looks pretty hard to integrate in a MATLAB script...

Comment only
16 Jul 2014 Parth

Parth (view profile)

Extremely useful - thank you! Any idea if there's an equivalent solution within MATLAB or the file exchange for OSX or Unix platforms?

Comment only
29 Dec 2013 Joao Henriques

Awesome work! I added this to my startup.m and finish.m files so that the computer doesn't sleep when I have MATLAB open (since I'm usually doing some heavy number-crunching).

21 Jul 2012 Jan Simon

Jan Simon (view profile)

Please consider this warning also: http://download.microsoft.com/download/9/c/5/9c5b2167-8017-4bae-9fde-d599bac8184a/AwayMode.doc

Comment only
25 Apr 2012 Francesco Montorsi

I've updated the ZIP file with corrected files!

Comment only
25 Apr 2012 Sam Roberts

The file insomnia_header.h appears to be missing from the submission.

Comment only
18 Apr 2012 Francesco Montorsi

yes, you're right. I will replace global with persistent keyword asap :)

Comment only
18 Apr 2012 Jan Simon

Jan Simon (view profile)

Perhaps you want to store insomnia_prevExecState as PERSISTENT instead of GLOBAL?

Comment only
25 Apr 2012 1.1

- changed global to persistent insomnia_prevExecState
- uploaded insomnia_header.h

Contact us