필터 지우기
필터 지우기

Determine the load order of referenced projects in a Matlab project

조회 수: 9 (최근 30일)
William Stokes
William Stokes 2023년 4월 5일
댓글: William Stokes 2023년 4월 18일
Is it possible to determine the order in which referenced projects are loaded in a Matlab project? There seems no obvious way to do it.
It is not possible to "drag" the order in the UI, and the order in the proj.ProjectReferences() does not appear to be respected when loading the project?
Is it possible?
  댓글 수: 2
Anurag Ojha
Anurag Ojha 2023년 4월 13일
Hi william,
Can you provide more information what exactly are you looking for, by load order do you mean in the order projects are loaded in MATLAB project?
William Stokes
William Stokes 2023년 4월 13일
Hello.
Yes, that is exactly what I mean.
Within our Matlab project we have two referenced projects. Ideally what I would like is for these projects to load in a specific order, so that the startup code of Project A runs before Project B. Currently there doesn't appear to be any way to explicitly specify that I want Project A startup to run first. I have tried
  • Removing both references and adding them back in, Project A first, then B.
  • The same as above but adding Project B first.
  • It does not appear to be alphabetical (the projects are not really named "Project A" and "Project B", and I observe the first one alphabetically does not load first).
  • I've tried getting the project object currentProject().ProjectReferences and modifying the order of the projects in this array, but this doesn't do it.
I appreciate that projects startup code should be independent and so it should probably not matter which order they load. That is true, but in this specific case, we have Project A creating a Python environment with pyenv which should happen first. The startup code for Project B requires some Python packages to be installed into an existing python environment if one is loaded, otherwise Project B will create its own environment. In this specific case, we want to ensure that Project A loads first, so that it creates the python environment, into which Project B can install the required packages.
I assumed that specifiying the loading order would be possible, but I cannot seem to find any obvious way to do it. Any help you can offer would be appreciated. Many thanks.

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

답변 (1개)

Anurag Ojha
Anurag Ojha 2023년 4월 14일
Hi William,
As per my understanding you want to know if it is explicitly possible to set the order in which projects are loaded in MATLAB Project. In Matlab project we use matlab.project.loadProject(projectPath) to load the project which loads the project specified by the file or folder projectPath. If any projects are currently open, MATLAB closes them before loading the specified project. There isn’t any way to explicitly determine the order in which projects are loaded.
To explore more, you can refer to the following MATLAB Documentations
Hope it helps!!

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by