colorbar no longer supported in GUIDE 2020a - quick fix?

2 次查看(过去 30 天)
I'm getting the following message when I open my .fig file in GUIDE (Matlab 2020a, Windows 10):
What's strange is that I wasn't receiving this error before in 2020a so I'm not sure what changed.
I understand GUIDE will no longer be supported but is there an equivalent object or configuration for colorbar I can use to prevent this error for now?
I can't make any changes to the file/GUI as a result so I'm stuck with the current configuration of the .fig file for my app.
When I do make a change and save the .fig and run the associated .m file, I get the following error:
Reference to non-existent field 'axes1'.
handles.axes1 being what I was using as the colorbar reference.
  10 个评论
Adam Danz
Adam Danz 2020-9-28
I've added that code (and some random numbers to defining missing vars) to a GUIDE gui opening function in r2020b. It creates the colorbar and it's displayed as expected. I opened the fig in GUIDE after doing this and everyting was OK. I opened the fig in GUIDE while the gui function was paused in debug mode and still, no problem.
Is it correct that this warning dialog appears only when you open the GUIDE figure in GUIDE and it appears every time, even if it's the first thing you do after restarting Matlab?
Steven Lord asked an important question to which we do not have an answer. What version of Matlab was this GUI written in?
Sean Tosin
Sean Tosin 2020-9-28
Yes, this dialogue only appears when I open the .fig file in GUIDE (i.e. right clicking on the file in Matlab environment and selecting Open In GUIDE) and appears every time, even if it's the first thing I do after restarting Matlab. If I just open the file (either by double clicking or right click then choose Open), this dialogue does not appear.
If I open the .fig in GUIDE and see this error and make even minor change to the GUI (i.e. move a text box) and save the .fig file and run the corresponding .m file, I get the "Reference to non-existent field 'axes1'" error.
Unfortunately, I inherited this code so it's been difficult to find the exact version this GUI was written, but I mentioned in a previous comment that it's very likely that the earliest version of Matlab used to write the GUI was 2019a

请先登录,再进行评论。

采纳的回答

Sean Tosin
Sean Tosin 2020-9-29
The issue was that the Tag for the matlab.graphics.axis.Axes object that I was using as the plot in my GUI was empty (no value) when it should have been labeled 'axes1'. I believe in the process of the editing the GUIDE at one time, the Tag was changed unknowingly from 'axes1' to an empty string ('') and saved and the next time that I opened the .fig in GUIDE the dialogue box regarding colorbar started to appear, warning that if I save colorbar will no longer be supported.
Essentially the solution that worked for me (pointed out by Matlab Tech Support) was to open the .fig in GUIDE, ignore the dialogue box (Click Ok) then go to the matlab.graphics.axis.Axes object and fill out the Tag for the object with its original name before it was (unknowingly) rewritten; in my case, the name 'axes1'

更多回答(1 个)

Walter Roberson
Walter Roberson 2020-9-28
this dialogue only appears when I open the .fig file in GUIDE (i.e. right clicking on the file in Matlab environment and selecting Open In GUIDE)
Don't Do That.
GUIDE-created .fig files are designed to only be opened from within the corresponding .m file. The .m file initializes the environment and then opens the .fig file and the .fig file needs the environment to have been initialized.
  6 个评论
Steven Lord
Steven Lord 2020-9-29
At this point, I agree with Adam Danz: I think further investigation is going to require seeing the figure and code files for this GUI. If you don't want to or can't post them on Answers, please contact Technical Support directly (using the telephone icon in the upper-right corner of this page) and ask the Support staff for assistance with this issue.
Sean Tosin
Sean Tosin 2020-9-29
I'll contact technical support directly then and see if the issue can be resolved and provide the solution here if I am able. Thanks for all your help so far!

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

标签

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by