App Designer Stops Functioning when adding components after GUIDE migration
Ältere Kommentare anzeigen
I've recenly migrated a MATLAB app from GUIDE to app deisgner. The migration worked well, but the app is now throwing errors after adding new components on a seperate tab. Nothing else about the code has been changed. There error message is occurs during my Opening Function:
function ecgigui2_OpeningFcn(app, varargin)
% Create GUIDE-style callback args - Added by Migration Tool
[hObject, eventdata, handles] = convertToGUIDECallbackArguments(app); %#ok<ASGLU>
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to ecgigui2 (see VARARGIN)
% Choose default command line output for ecgigui2
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
end
It reads:
Unrecognized method, property, or field 'Type' for class 'matlab.graphics.shape.internal.ScribePeer'.
If I delete the added components, the app works fine again. Please help!
4 Kommentare
Allen
am 1 Mär. 2021
I have on several occasions tried to migrate apps from GUIDE to App Designer (AD), but with much success that you. However, having spent a lot of time in AD rebuilding my old GUIs, it looks like the migration process does not fully update the old code to new AD framework formatting. AD uses class definitions, which stores and passes the object data/properties more directly, and without the need for guidata(). Also, whenever you create new graphics components, AD automatically add them using the new formatting, which seems to be what is going on when you add new components to your migrated app and is not compatible with the GUIDE formatting that is shown in the snippet you provided.
If you are able to find the new sections of code that are automatically added when you add a new component in AD, could you proivde a snippet? This should help to verify if my assumption is accurate.
Akanksha Mishra
am 11 Mär. 2021
Bearbeitet: Akanksha Mishra
am 12 Mär. 2021
@Alle Here is snippet of my code where new element Tabgroup1 is added by me.
Kindly help how this error can be resolved ?
Allen
am 11 Mär. 2021
Akanksha,
I think that the issue has something to do with the change of the primary data structure changing from handles to app and then occurs during the convertToGUIDECallbackArguments(app) function. Other than taking the long route to resolving the issue and manually rebuilding the application with AppDesigner, take a look at the link below for a few extra steps that you might take to get your new app working. As I mentioned previously, I have not had much success at using the migration tool with my old apps.
Akanksha Mishra
am 12 Mär. 2021
I coulndt find anything new/helpful on the link page.
Yes issue is in the Conversion function as you pointed but isnt this absolutely unreasonable ? I mean to say that once guide tool is migrated to app, obviously developer may want to add new components to it. So not handling that change is very unreasonable for the migration tool. This is ofcourse only if I am understanding the issue correctly. But looking at the original question by @Zachary Eisner in this thread tells me same. As i am facing exactly similr issue.
@Zachary Eisner Did you find a solution for this problem ?
Antworten (2)
Akanksha Mishra
am 11 Mär. 2021
0 Stimmen
I am facing exactly same errors for my migrated app. Kindly provide solution this someone please.
AZ
am 7 Mai 2021
This error is indicative of a bug in MATLAB. In order to work around this bug, add the following three lines of code before convertToGUIDECallbackArguments in the Opening Function (also called a ‘StartupFcn’ in App Designer).
- Note 1: Ensure that the first line of code below has the correct name of your app’s UIFigure (‘app.UIFigure’ could be named ‘app.figure1’ in your app).
- Note 2: These lines of code only need to be added to the top of the Opening Function. They don't need to be added before every single call to convertToGUIDECallbackArguments in the app.
This is the code to copy/paste into the app:
allAxes = findall(app.UIFigure, 'Type', 'axes');
arrayfun(@(ax) disableDefaultInteractivity(ax), allAxes)
oncleanup = onCleanup(@() arrayfun(@(ax) enableDefaultInteractivity(ax), allAxes));
1 Kommentar
Lee
am 20 Okt. 2022
I am now suffering this exact problem in Matlab 2020b. Thankfully I found this bugfix - has this been properly resolved in a more recent release?
Kategorien
Mehr zu Data Type Identification finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!