0

I have a MATLAB program that I intend to run on different machines. Is there a way to get, from within MATLAB itself, the following info:

  • Name of machine
  • Specs of machine, especially processor and memory configuration
  • Number of cores deployed for MATLAB

I know the command computer but I require more than what it outputs. I'd like to write all the info above to a text file.

yurnero
  • 315
  • 2
  • 9

1 Answers1

2

You are looking for the following:

1) To check the type of computer on which MATLAB is executing, use: computer .

2) The following displays information about your Windows:

winqueryreg('HKEY_LOCAL_MACHINE',...
     'Software\Microsoft\Windows NT\CurrentVersion','ProductName')

or in general, to get information about the OS, use: feature('GetOS').

3) To check number of processors, use: getenv('NUMBER_OF_PROCESSORS').

4) To check CPU information, use: feature('GetCPU').

5) To get information about cores, use: feature('numCores') .

6) To check memory used by MATLAB, total physical memory and some other information, use: memory.

Note that: Some of the above are undocumented and taken from Yair Altman's blog.

Finally, to write data in a text file, you can use: fprintf .

Sardar Usama
  • 19,536
  • 9
  • 36
  • 58
  • I need to learn what these are but it seems to be exactly what I want. Thank you so much for this and the link. – yurnero Oct 02 '16 at 17:36
  • Would you know how to get all the output of feature('numCores')? If I assign a variable to it, I only get a number whereas when I run the command as is, it prints out 4 lines with more detailed info. I'd like to get those 4 lines. – yurnero Oct 02 '16 at 17:50
  • 2
    When you assign it to a variable, it gives you *Number of cores deployed for MATLAB*, which you originally asked in the question. The rest of the information is a bonus! And if you want to store all that information in a text file, here is a workaround: http://stackoverflow.com/questions/5833356/how-to-save-contents-of-matlabs-command-windows-to-in-a-file – Sardar Usama Oct 02 '16 at 18:10
  • Got i! I found another work around using evalc. Thanks again for your help. – yurnero Oct 02 '16 at 18:30
  • @yurnero Would you mind sharing how you used `evalc` here? – Sardar Usama Oct 02 '16 at 18:36
  • 1
    Of course. I use `memoryinfo = evalc('feature memstats');` which dumps the entire output of `feature('memstats')` into the string `memoryinfo`. Then I manually extract the relevant info from `memoryinfo`. Cheers. – yurnero Oct 02 '16 at 21:05
  • 1
    @yurnero For information about cores, you probably meant to write: `evalc('feature numCores');` but anyway I understand that. I also learnt something new – Sardar Usama Oct 02 '16 at 21:14