Find by command line (.m script) the Source File for a loaded model

Hello, Is it anybody that could help me to find how to read by command line (.m script) the Source File for a loaded model? This model property can be found in the Model Properties, under Main tab in Model information. I cannot use:
info = Simulink.MDLInfo(ModelName);
as I have two distinct projects with identical structure and filenames. I am also changing often between projects and I need to find which model is currently opened. Thanks in advance!

 채택된 답변

Fangjun Jiang
Fangjun Jiang 2018년 1월 18일

0 개 추천

bdroot(gcs) or bdroot(gcb) might be what you need.

댓글 수: 3

No, it does not help as bdroot gives the root of the model not the path.
Fangjun Jiang
Fangjun Jiang 2018년 1월 19일
편집: Fangjun Jiang 2018년 1월 19일
okay, that will be get_param(bdroot,'Filename')
Yes, you are right, I got it running! Thanks for your help!
get_param(ModelName,'Filename')

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Programmatic Model Editing에 대해 자세히 알아보기

질문:

2018년 1월 18일

댓글:

2018년 1월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by