Borrar filtros
Borrar filtros

Variable 'a11' has been deleted from base workspace

75 visualizaciones (últimos 30 días)
Leon Dowling
Leon Dowling el 15 de Nov. de 2019
Comentada: Manoj Kumar Kar el 23 de Ag. de 2021
Hi, first time asking a question on here. Mature college student so id hardly even call myself a beginner at Matlab. I was writing a script running along a Simulink model. I had defined the variables of a 3x2 matrix into a state space. A = [a11 a12 a13;a21.....] etc. The variables were and are still in my Matlab script and were previously working, ie showin values in the workspace. However, Matlab crashed, an error popped up that Matlap had encountered an error and needed to close. Upon reopening, and using "Run", a new error pops up declaring the matrix variables have been deleted from the base workspace, suggested action 1: Undo the deletion (This fails with Information necessary to undo deletion is no longer available. Use a different fix. Action 2: create a new variable (this promts a folder to open wherby I selected the original .m file, this also fails). ALL variables error out like this. I have copied the script into a new script in a new folder along with the simulink script and renamed them however, the same error appears. The only difference I can see is in the new location there is no .slprj file generated. The only next step I see is to re-write everything again, but ive no garauntee that will solve anything. Using R2019b
Any help appreciated.
  1 comentario
Manoj Kumar Kar
Manoj Kumar Kar el 23 de Ag. de 2021
This problem occurs when you are writing clear all or close all in the program . clear all deletes all the variable, so during function call the error arises. If you are writing clear all then after that define global variable or simply remove clear all. This will solve the issues.

Iniciar sesión para comentar.

Respuestas (1)

Siriniharika Katukam
Siriniharika Katukam el 18 de Nov. de 2019
Editada: Siriniharika Katukam el 18 de Nov. de 2019
Try defining the variable in the model itself.
You can do it in this way, open "Model settings -> Model properties" and initialize your variables there in the callbacks. Even upon restart, your variables does not get deleted.
This link might be helpful!


Más información sobre Simulink Functions en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by