Environment incompatibilities for system command
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
Walter Roberson
2024-3-5
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)
回答(1 个)
Chandrika
2024-7-3
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Arduino Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!