Creating a new function in App Designer places the new function inside of another function

2 views (last 30 days)
When I create a new function using the add function button, the function is always placed at the end of one of my other functions example:
function results = oldFunction(app)
%Code
function results = func2(app)
end
end
Cutting and pasting or moving the old function doesn't solve this issue, the next new function will still initially appear inside the same old function. I can move the new function out of the old one but it is annoying and tedious. Anyone have an idea as to why this is happening?
  4 Comments
Adam Danz
Adam Danz on 18 Jan 2022
If you have access to a different release of Matlab, it might be helpful to open the app in the other release using appdesigner. Matlab does some compatability checks on apps that are opened in a different version than they were created and this might fix the problem (emphasis on might). Just make a backup copy of the app before doing this.
I assume this only happens with a single app and not with all apps, correct?
I've noticed this behavior in the past as well but it was fixed by closing/reopening the app in appdesigner or closing/reopening Matlab.
Austin Burritt
Austin Burritt on 18 Jan 2022
Edited: Austin Burritt on 18 Jan 2022
This is the only app I have under development currently, but yes it is just this app and one specific function. Through a fortunate refactor that bothersome function doesn't exist any longer in the code so I don't have plans to do more troubleshooting, I'll leave that to the support team. Opening and closing MATLAB or App Designer did not change anything, but it's possible a full computer restart could've done the trick. It wasn't in the way enough to invest many hours or thought into getting around it.

Sign in to comment.

Answers (1)

Cris LaPierre
Cris LaPierre on 18 Jan 2022
It shouldn't be doing this. Please try restarting MATLAB.
If the issue returns, please contact support.
  2 Comments
Austin Burritt
Austin Burritt on 18 Jan 2022
This issue has persisted through multiple restarts and app closures. I'll bring the issue to support.
Cris LaPierre
Cris LaPierre on 18 Jan 2022
In can be an inconvenience, but I would try reinstalling MATLAB. At best, the problem gets fixed, and at worst, you are back where you started.

Sign in to comment.

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!