length(Sys​tem.Diagno​stics.Proc​ess.GetPro​cessesByNa​me()) always 1

Is detailed in the Title, in my code
n = 'photoshop' (used as example)
When Photoshop is closed:
System.Diagnostics.Process.GetProcessesByName(n)
Length: 0
...
System.Diagnostics.Process.GetProcessesByName('photoshop')
Length: 0
...
length(System.Diagnostics.Process.GetProcessesByName(n))
ans = 1
length(System.Diagnostics.Process.GetProcessesByName('photoshop'))
ans = 1
If Photoshop is open, all values listed change to / stay 1.
Honestly I'm utterly stuck. My main goal was to check whether a specific .exe was running. Maybe this code snippet isn't even neccessary but this seemed the most useful for me at this point. Any help is appreciated!

Respuestas (0)

Categorías

Más información sobre Line Plots en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 18 de Mzo. de 2019

Editada:

el 18 de Mzo. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by