save(filename, var) cant find workspace variable even if it exist
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Joakim Magnusson
el 24 de Jun. de 2015
Comentada: Stephen23
el 25 de Jun. de 2015
From my script i am trying to use save to store my workspace stucture to a .mat file. But i get following error message:
>> TestGUI Error using save Variable 'NewTest' not found.
In my script i use save like this:
save('NewTest.mat','NewTest');
I can see that my structure exists in the workspace, any idea why save don't find my variable?
Respuesta aceptada
Stephen23
el 24 de Jun. de 2015
The error message and the quoted code code give two different variable names: 'NewTest' vs 'newTest'.
Capitalization is significant in MATLAB!
It is not possible for both of these to be correct, so which one is right?
7 comentarios
Stephen23
el 24 de Jun. de 2015
Editada: Stephen23
el 24 de Jun. de 2015
My pleasure!
It is levels of abstraction: suddenly thinking about multiple workspaces also means more complicated planning... but also more power! Please ask if you have any questions about how to use workspaces. Start small, look at the docs, find some examples on FEX, try out how it works... Good luck!
EDIT: one of the key things to understanding about functions is that they encapsulate and abstract some operation. It should not be required to poke around other workspaces because the whole point of a function is that it is a black box: all that matter is the input and output, not what happens in between (i.e. how it does it). This is the point of having separate workspaces... they keep operations conceptually independent.
Más respuestas (1)
Joakim Magnusson
el 24 de Jun. de 2015
Editada: Joakim Magnusson
el 24 de Jun. de 2015
0 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!