Azzera filtri
Azzera filtri

Environment incompatibilities for system command

19 visualizzazioni (ultimi 30 giorni)
Noelia Martinez Molina
Noelia Martinez Molina il 5 Mar 2024
Risposto: Chandrika il 3 Lug 2024 alle 7:54
Dear community,
I'm using a Matlab-based toolkit, the lesion quantification toolkit: lesion quantification toolkit
I'm a bit confused by one thing. This toolkit executes an application externally called DSI studio by launching the terminal from Matlab using the "system" command. Actually, I had to modify this and use system instead of the original combination of eval and ! as the toolkit was developed using a Linux platform.
My confusion comes from the fact that without starting the toolkit I can actually use the system command to run some operations in DSI studio from Matlab. But (!!) if I run the function from the toolkit where the system command is used to execute DSI studio externally, I get the following error message:
/bin/bash: /Applications/dsi_studio.app/Contents/MacOS/dsi_studio/: Not a directory
"Not a directory" is false, as I can run the same command without errors before starting the toolkit. My deduction is that the toolkit is setting the wrong environment for the system command?
This is the original code snippet that works without starting the toolkit and using a cfg file with the paths and filenames:
cmd= sprintf('%s --action=ana --source=%s --tract=%s --output=%s --connectivity=%s --connectivity_type=%s --connectivity_threshold=0 --export=tdi',...
cfg.dsi_path,fullfile(cfg.source_path, source_fib),fullfile(cfg.source_path, all_tracts),out_file,cfg.parcel_path,cfg.con_type);
system(cmd)
I would appreciate if a more advanced Matlab user could confirm my suspicion and help me to find a workaround for this?
Thank you in advance for your time!!
Best,
Noelia
  2 Commenti
Walter Roberson
Walter Roberson il 5 Mar 2024
cmd= sprintf('"%s" --action=ana --source="%s" --tract="%s" --output="%s" --connectivity="%s" --connectivity_type="%s" --connectivity_threshold=0 --export=tdi',...
cfg.dsi_path,fullfile(cfg.source_path, source_fib),fullfile(cfg.source_path, all_tracts),out_file,cfg.parcel_path,cfg.con_type);
system(cmd)
Noelia Martinez Molina
Noelia Martinez Molina il 6 Mar 2024
Thank you for your reply, Walter. I used the double quotes but still I'm getting exactly the same error.
How can I check the current environment in Matlab? Maybe that could help to see whether the toolkit is changing the environment and that's why I keep getting this error.

Accedi per commentare.

Risposte (1)

Chandrika
Chandrika il 3 Lug 2024 alle 7:54
Hello Noelia,
You may use the "getenv" function to display the environment variables before and after running the Lesion Quantification Toolkit in MATLAB to check if the Toolkit is altering the environment.
You may find detailed information on the "getenv" function in the following documentation:
Hope it helps!
Regards,
Chandrika

Categorie

Scopri di più su Environment and Settings in Help Center e File Exchange

Prodotti


Release

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by