App Designer Line 1 Class Name Error on any App
Ältere Kommentare anzeigen
When attempting to run any app using App Designer (even tutorial apps or blank apps), I receive the following error.
Error using app1
Error: File: app1.mlapp Line: 1 Column: 10
Class name and filename must match.
The first line of the app code is autogenerated and not editable:
classdef app1 < matlab.apps.AppBase
As far as I can tell, the class name and filename do match. Filename: app1.mlapp
When selecting the "Pause on Errors" Run option, it pauses on this line in AppManagementService.m:
100 runningApp = evalin('base', sprintf('%s(%s);', command, appArguments));
In base workspace.
I'm brand new to App Designer and might be missing something fundamental here. All the tutorials I can find do not mention this error or define any setup needed to avoid it.
Antworten (2)
Jonathan Buchholz
am 16 Aug. 2024
2 Stimmen
Siraj
am 31 Jul. 2024
Hi!
I understand that you are encountering an issue where MATLAB is unable to run any app created with App Designer, even tutorial or blank apps, due to an error indicating that the class name and filename must match. Here’s a potential solution:
- Ensure that the filename and class name match exactly, including case sensitivity. For example, if your class name is "app1", the filename should be "app1.mlapp".
- Check for hidden characters, sometimes, hidden characters or spaces might cause issues. Make sure there are no trailing spaces or hidden characters in the filename or class name.
- Clear your MATLAB workspace and cache to ensure there are no conflicts.
>> restoredefaultpath
>> rehash toolbox
>> rehash toolboxcache
>> clear all;
Ensure that the directory containing your app file is on the MATLAB path. You can add the directory to the path using the "addpath" function.
>> addpath('your_directory_path');
Hope this helps.
Kategorien
Mehr zu Develop Apps Using App Designer 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!