The function uses WMIService to get Information via WMI_MSAcpi_ThermalZoneTemperature-Class about the CPU.
It is an example on how to connect to COM and take use of Computer services.
Attention: BIOS must support temperature information.
Hi.
Very nice idea, but when I try to run the file - I get the next error:
??? Invoke Error, Dispatch Exception:
Source: SWbemLocator
Description: Not found
Error in ==> getCPUTemperature at 16
objService = objLocator.ConnectServer('.', 'root\WMI'); % connet to WMI
Haim, I guess maybe access is denied - do you start Matlab as an administrator? Can you download and run this as administrator: http://www.microsoft.com/download/en/details.aspx?id=8572 With this tool you can query the WMIService.
There you can connect to root\wmi and go to namespace MSAcpi_ThermalZoneTemperature. There you can select some parameters and ask for it. Does this work?
Very nice idea, indeed, but your code will only work for windows vista & 7 and not for XP! The reason is because the ItemIndex method is not present in XP. How can one code it for windows XP?
Hi DAdler - thank for rating.
I thougt that it will work under XP as well, however if if won't you can download the WMI-CodeCreator:
http://www.microsoft.com/download/en/details.aspx?id=8572 and than you can create the query for the XP-System. When the query works you can compare the VBScript from the wmicreator and the matlab code. In my opinion it is only necessary to get the query object with all data.
If you have trouble, maybe you can send me the error-message.
Hi DAdler, can you please download and run the WMI-CodeCreator: http://www.microsoft.com/download/en/details.aspx?id=8572.
In the tab "Query data from a WMI class" ypu select in the first listbox: root\WMI,
in the second listbox you select "MSAcpi_ThermalZoneTemperature" then in the third listbox you press shift und select all then you press the button "Search for Property Values" - does any value appear (?) or is there written the result is not supported?
Maybe you cam make a screenshot from WMICodeCreator with the query and the result?!
Hello and thank you for your willingness to help. I can certainly run WMI-CodeCreator without problems and it does give me some results when I query the data from root\WMI. For example, both the VBS script I wrote above and WMI-CodeCreator give me the following results:
Hello DAdler - my problem is, that I haven't the possebility to check the code on XP (in XP Mode of WIN 7 it doesn't produce results). However, when you get an answer from the WMICreator as you wrote, you can try the following:
1. set a breakpoint to line 21
2. go to matlab-prompt an run: >> t=colItems.get
3. then prompt >>t.Count --> is there a number or a message as answer?
4. If there is a number you can try to prompt >>colItems.Item(xy).get where xy is the number
Hi Sven, how are you?
thank you so much for your code.
I was trying to use it, but an error message appears:
>> info=getCPUTemperature
??? Invoke Error, Dispatch Exception:
Source: SWbemObjectSet
Description: Not supported
Error in ==> getCPUTemperature at 21
for i=1:1:colItems.Count
I installed WMI-CodeCreator and folloed the instructions you write to DAdler. As I pressed the button "Search for Proertie Values", the message "Results:Not supported" is given. Do you have any suggestions?
Thanks