How to locate all sl_customization files on the MATLAB path?
조회 수: 3 (최근 30일)
이전 댓글 표시
In MATLAB versions up to R2019b I was able to use
which -all sl_customization
to locate all sl_customization.m and sl_customization.p files on the MATAB search path. That doesn't work anymore in newer versions.
Is there a new way to get this information?
댓글 수: 5
채택된 답변
Angelo Yeo
2023년 8월 11일
편집: Angelo Yeo
2023년 8월 11일
1) The official doc for which indates that "which -all" displays the paths to all items on the MATLAB path with the requested name, as well as any files in special folders that have been implicitly added to the path.
2) In R2022b, files with name including "sl_customization" (m or p files) can be found with Windows Explorer in MATLAB root folder as shown below. And none of the pathstr are members of MATLAB path as you can find with the script below.
str2test_R2022b = [
"C:\Program Files\MATLAB\R2022b\examples\slrequirements\main\sl_customization.m"
"C:\Program Files\MATLAB\R2022b\toolbox\rtw\rtwdemos\crl_demo\sl_customization.m"
"C:\Program Files\MATLAB\R2022b\toolbox\qualkits\iec\ecoder\tests\sl_customization.m"
"C:\Program Files\MATLAB\R2022b\toolbox\rtw\rtwdemos\pil_demo\sl_customization.m"
"C:\Program Files\MATLAB\R2022b\toolbox\coder\advisor\examples\sl_customization.m"
"C:\Program Files\MATLAB\R2022b\resources\Sldv\en\ModelAdvisor\sl_customization.xml"
"C:\Program Files\MATLAB\R2022b\toolbox\rtw\rtwdemos\examplePilF28335\sl_customization.m"
"C:\Program Files\MATLAB\R2022b\examples\ecoder\main\sl_customization.m"
"C:\Program Files\MATLAB\R2022b\examples\slcheck\main\sl_customization.m"
"C:\Program Files\MATLAB\R2022b\examples\systemcomposer\main\sl_customization.m"];
is_in_path = false(1, length(str2test_R2022b));
for i = 1:length(str2test_R2022b)
[pathstr, name, ext] = fileparts(str2test_R2022b(i));
is_in_path(i) = contains(lower(path), lower(pathstr{1}));
end
is_in_path =
1×10 logical array
0 0 0 0 0 0 0 0 0 0
3) On the other hand in R2019b, files with name including "sl_customization" (m or p files) can be found with Windows Explorer in MATLAB root folder as shown below. And 23 of them are included in the MATLAB path. This is what is shown in "which -all".
str2test_R2019b = [
"C:\Program Files\MATLAB\R2019b\toolbox\autoblks\autoblksutilities\sl_customization.p"
"C:\Program Files\MATLAB\R2019b\toolbox\aeroblks\aeroblksutilities\sl_customization.p"
"C:\Program Files\MATLAB\R2019b\toolbox\plccoder\plccoder\ladderlogic\plclib\studio5000\sl_customization.p"
"C:\Program Files\MATLAB\R2019b\toolbox\shared\aeroblks\aeroblksutilities\sl_customization.p"
"C:\Program Files\MATLAB\R2019b\toolbox\slcoverage\sl_customization.p"
"C:\Program Files\MATLAB\R2019b\toolbox\simulink\simulink\modeladvisor\sl_customization.p"
"C:\Program Files\MATLAB\R2019b\toolbox\simulink\sta\sl_sta_editor_block\sl_customization.p"
"C:\Program Files\MATLAB\R2019b\toolbox\simulink\simulink\SortingCheck\sl_customization.p"
"C:\Program Files\MATLAB\R2019b\toolbox\shared\codeinstrum\codeinstrum\sl_customization.p"
"C:\Program Files\MATLAB\R2019b\toolbox\fixedpoint\embeddedlib\sl_customization.m"
"C:\Program Files\MATLAB\R2019b\toolbox\robotics\robotsimulink\sl_customization.m"
"C:\Program Files\MATLAB\R2019b\toolbox\nav\navsimulink\sl_customization.m"
"C:\Program Files\MATLAB\R2019b\toolbox\shared\robotics\robotslcore\sl_customization.m"
"C:\Program Files\MATLAB\R2019b\toolbox\stateflow\stateflow\sl_customization.m"
"C:\Program Files\MATLAB\R2019b\examples\slcheck\main\sl_customization.m"
"C:\Program Files\MATLAB\R2019b\examples\slrequirements\main\sl_customization.m"
"C:\Program Files\MATLAB\R2019b\toolbox\slcheck\slcheckdemos\advisordemos\sl_customization.m"
"C:\Program Files\MATLAB\R2019b\toolbox\simrf\simrf\sl_customization.m"
"C:\Program Files\MATLAB\R2019b\toolbox\rtw\rtwdemos\crl_demo\sl_customization.m"
"C:\Program Files\MATLAB\R2019b\toolbox\qualkits\iec\ecoder\tests\sl_customization.m"
"C:\Program Files\MATLAB\R2019b\toolbox\rtw\rtwdemos\pil_demo\sl_customization.m"
"C:\Program Files\MATLAB\R2019b\toolbox\coder\advisor\examples\sl_customization.m"
"C:\Program Files\MATLAB\R2019b\toolbox\rtw\rtwdemos\examplePilF28335\sl_customization.m"
"C:\Program Files\MATLAB\R2019b\toolbox\physmod\elec\library\m\sl_customization.p"
"C:\Program Files\MATLAB\R2019b\toolbox\physmod\ne_sli\ne_sli\sl_customization.p"
"C:\Program Files\MATLAB\R2019b\toolbox\shared\nav_rst\nav_rst_simulink\sl_customization.m"
"C:\Program Files\MATLAB\R2019b\toolbox\robotics\robotsimulink\robotslgazebo\sl_customization.m"
"C:\Program Files\MATLAB\R2019b\toolbox\robotics\robotsimulink\robotslmanip\sl_customization.m"
"C:\Program Files\MATLAB\R2019b\toolbox\robotics\robotsimulink\robotslmobile\sl_customization.m"
"C:\Program Files\MATLAB\R2019b\toolbox\physmod\powersys\library\sl_customization.p"
"C:\Program Files\MATLAB\R2019b\toolbox\slcontrol\slctrlutil\sl_customization.p"];
is_in_path = false(1,length(str2test_R2019b));
for i = 1:length(str2test_R2019b)
[pathstr, name, ext] = fileparts(str2test_R2019b(i)); % Run this in R2019b
pathstr_saved{i} = pathstr{1};
is_in_path(i) = contains(lower(path), lower(pathstr{1}));
end
pathstr_saved(is_in_path)
whichpath = which('sl_customization','-all')
추가 답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!