Environment incompatibilities for system command
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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
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)
Risposte (1)
Chandrika
il 3 Lug 2024
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
0 Commenti
Vedere anche
Categorie
Scopri di più su Arduino Hardware 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!