GUI gives error after moving to a different computer

조회 수: 7 (최근 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 CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

태그

제품


릴리스

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by