GUI gives error after moving to a different computer

5 ビュー (過去 30 日間)
Shahar Goren
Shahar Goren 2019 年 1 月 14 日
コメント済み: Bruno Luong 2019 年 7 月 30 日
I have written a GUI using GUIDE in order to view and analyse 3d quiver plots.
Once I moved it to a different computer (both .fig and .m files), it gives the error:
Undefined function or variable 'addToolbarExplorationButtons'.
Error in matlab.graphics.internal.figfile.FigFile/read>@(fig,~)addToolbarExplorationButtons(fig)
I also can no longer edit it using guide.
other than that, the gui actually works fine if I ignore the error, but I would like to modify it on this computer.
Thanks!
  6 件のコメント
TADA
TADA 2019 年 1 月 14 日
編集済み: TADA 2019 年 1 月 14 日
Can You Still Access The Other Computer?
If So, Follow These Steps To Export All Of It To A Code File:
Now You Have Two Options
  1. Stick To The Code File And Give Up On Guide (My Suggestion)
  2. Take The Code And Generate A Guide Figure Back In Your Second Computer (the One With 2016) as Suggested Here
I Personally Have No Love For Layout Editors In General, But Of All The Ones I've Ever Used, Guide Is By Far The Worst And Your Problem Is A Good Example Of That. Code Is Text. It Should Not Be Hidden From The Developer In Binary Files.
Bruno Luong
Bruno Luong 2019 年 7 月 29 日
Have the same problem of "Undefined function or variable 'addToolbarExplorationButtons'." when GUI is developped under 2019a and use it with 2016b.
The Export/Import game indicated by TADA has really no use, since it breaks too many things.

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

回答 (1 件)

TADA
TADA 2019 年 7 月 29 日
編集済み: TADA 2019 年 7 月 29 日
Another possible workaround would be to create a stub of this function
Unfortunately this function is not a builtin, so builtin can't be used to call the original
still here's a solution that should enable keeping the functionality in later versions and the stub in earlier versions is this:
This is a very dirty workaround, but it works for me with R2018b, I don't have an earlier version to test when the file is missing, but I think it should work
Anyway, creatae an .m file function for the misbehaving addToolbarExplorationButtons (probably need to do the same thing with removeToolbarExplorationButtons as well
function addToolbarExplorationButtons(varargin)
originalFunctionPath = fullfile(matlabroot, 'toolbox', 'matlab', 'plottools');
if exist(fullfile(originalFunctionPath, 'addToolbarExplorationButtons.p'), 'file')
currDir = pwd;
cd(originalFunctionPath);
addToolbarExplorationButtons(varargin{:});
cd(currDir);
end
end
Hopefully there aren't too many other function calls that GUIDE sneaks in
I'm also not sure that these function are located in the same folders for all versions of matlab, so it may be necessary to check where they are located with your version using
which('addToolbarExplorationButtons')
I also have doubts that this workaround would work with published compiled code...
  1 件のコメント
Bruno Luong
Bruno Luong 2019 年 7 月 30 日
I like the idea eben if it's "dirty".
I my case it requires I put the addToolbarExplorationButtons function on the PC with old MATLAB. That's OK. I don't want to mess with addToolbarExplorationButtons on the new release.
This is another nasty effect of the new Toolbar which break the compatibility of GUI accross the versions (even they all use HG2).
I actually ended of redesign my GUI with old MATLAB, it takes me one day of work.

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

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

タグ

製品


リリース

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by