Table of Contents
qc_set_priority
Sets the priority of the MATLAB process and/or thread on the host.
qc_set_priority(process_priority, thread_priority) % Set the process and thread priorities qc_set_priority(thread_priority) % Set the thread priority qc_set_priority % Restore normal priorities
Sets the priority of the MATLAB process and/or thread. This function is typically used when implementing a control system in a MATLAB script or when time-sensitive operations are performed. This function MUST BE USED WITH CAUTION because MATLAB can interfere with other applications and even the operating system itself if the priorities are set too high.
process_priority
The priority for the MATLAB process. Valid values in Windows are:
Priority |
Description |
---|---|
-2 |
idle priority (use for very low priority background processing) |
-1 |
below normal priority (helpful if MATLAB or Simulink is hogging the CPU) |
0 |
normal priority |
1 |
above normal priority |
2 |
high priority |
3 |
real-time priority (NOT RECOMMENDED because MATLAB could hang the system!) |
thread_priority
The priority for the MATLAB thread, relative to the process priority. Valid values in Windows for all process priorities except real-time priority are:
Priority |
Description |
---|---|
-3 |
idle priority (use for very low priority background processing) |
-2 |
lowest priority |
-1 |
below normal priority |
0 |
normal priority |
1 |
above normal priority |
2 |
high priority |
3 |
time critical priority |
If the process priority is set to real-time priority, then the thread priories may range from -8 to 7 on Windows, with -8 being the idle priority and 7 being the time critical priority. Priority 0 is still normal priority in this case.
This function has no outputs.
qc_set_priority(3); % bump up the priority of the MATLAB thread to time critical try % ... do time critical operations ... catch end qc_set_priority; % restore normal priority
Copyright ©2024 Quanser Inc. This page was generated 2024-10-17. Submit feedback to Quanser about this page.
Link to this page.