MATLAB Answers

0

GUI gives error after moving to a different computer

Asked by Shahar Goren on 14 Jan 2019
Latest activity Commented on by Bruno Luong
on 30 Jul 2019
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 Comments

Thanks.
I will try to see if I can update the version on the other computer.
Is there no other way to get around this?
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.
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.

Sign in to comment.

Tags

Products


Release

R2016b

1 Answer

Answer by TADA
on 29 Jul 2019
Edited by TADA
on 29 Jul 2019

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 Comment

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.

Sign in to comment.