フィルターのクリア

Prevent figure call from .p file

1 回表示 (過去 30 日間)
Oliver Warrington
Oliver Warrington 2022 年 9 月 22 日
コメント済み: Rik 2022 年 9 月 23 日
I need to run a function from a software package that is written in a .p file. To run it on a cluster, I need to start matlab with the following options:
matlab -nojvm -nodesktop -nosplash -nodisplay -singleCompThread
The .p file attempts to make figures which cause matlab to crash due to nojvm. Is there anyway to prevent the figure creation without being able to edit the source code?
Thanks in advance!
  7 件のコメント
Rik
Rik 2022 年 9 月 23 日
The whole point of p code is to prevent the end user digging around, so perhaps the writer of the code used the builtin() function to ensure built-in functions are called.
The inconsistent behavior is odd. I wonder whether it has something to do with the OS.
Walter Roberson
Walter Roberson 2022 年 9 月 23 日
My guess at the moment would be that it has to do with Answers running in a LiveScript environment. LiveScript must be implicitly intercepting figure() so that it can inline figures.

サインインしてコメントする。

回答 (1 件)

Oliver Warrington
Oliver Warrington 2022 年 9 月 23 日
I did get this to work by using a brute force version of replacing the built in functions, as suggested in the comments.
I created dummy versions of the graphics, graph2d, graph3d and specgraph folders. Replaced all the functions, so no subsequent plot call of any kind would throw an error. Then removed the built in versions from the path and added my dummy versions.
rmpath(genpath('/usr/local/MATLAB/R2021b/toolbox/matlab/graph2d'))
rmpath(genpath('/usr/local/MATLAB/R2021b/toolbox/matlab/graphics'))
rmpath(genpath('/usr/local/MATLAB/R2021b/toolbox/matlab/specgraph'))
rmpath(genpath('/usr/local/MATLAB/R2021b/toolbox/matlab/graph3d'))
addpath(genpath('./graphics'));
addpath(genpath('./graph2d'));
addpath(genpath('./specgraph'));
addpath(genpath('./graph3d'));
Not sure this would be recommended in general, but my results are as expected and I can now run it on a cluster!
  1 件のコメント
Rik
Rik 2022 年 9 月 23 日
I'm sure I would not recommend this in general, but in your case it seems the only feasible solution.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by