MATLAB Answers

How to store text printed to console?

5 views (last 30 days)
The following code
>>system('WMIC CPU Get NumberOfLogicalProcessors')
prints
NumberOfLogicalProcessors
8
How can I store this number (8) in a variable?

  0 Comments

Sign in to comment.

Accepted Answer

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH on 11 Nov 2019
solution:
[status,result]=system('WMIC CPU Get NumberOfLogicalProcessors');
number = str2double(regexp(result, '\d+', 'match'))

  0 Comments

Sign in to comment.

More Answers (0)

Sign in to answer this question.


Translated by