Azzera filtri
Azzera filtri

A function that will open a windows command prompt and check the network licenses available?

12 visualizzazioni (ultimi 30 giorni)
My goal is to have a MATLAB function I can call that will print the in-use network licenses to the command window, then return control to MATLAB without having to Ctrl+C. The $MATLAB, $ARCH, $LICENSE PATH have all been replaced with the appropriate folder locations in my code.
Current Code:
function checkLicense()
%checkLicense Checks to see if MATLAB licenses are available
!cmd.exe
sprintf('cd $MATLAB/etc/$ARCH')
sprintf('lmutil lmstat -a -c "$LICENSE PATH"')
end
This will give access to the cmd.exe through MATLAB's command window, but doesn't print out the actual commands (looking at it now, it's obvious that wouldn't work because I'm giving control to cmd.exe, not MATLAB).
What I've Tried:
Using the dos( __,'-echo')_ and system( __,'-echo')_ functions to cd and use 'lmutil', I get the error:
'lmutil' is not recognized as an internal or external command, operable program or batch file.

Risposta accettata

Mike Crawford
Mike Crawford il 19 Lug 2018
Figured it out! I didn't know DOS accepted multiple commands using '&'. Working code:
function checkLicense
%checkLicense Checks to see if MATLAB licenses are available
command = 'cd $MATLAB/etc/$ARCH & lmutil lmstat -a -c "$LICENSE PATH"';
dos(command, '-echo')
end

Più risposte (0)

Categorie

Scopri di più su Manage Products in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by