scope of disp()
Mostrar comentarios más antiguos
Hi there,
I am trying to call a function that uses several calls to disp() to print out several messages to the workspace. Let's call this function "function B". So, function B then gets called from function A. The problem?
When I call function B from the workspace, function B displays the messages correctly, but when I call function A from the workspace (which then calls function B), none of the messages show. How can I get the messages to show even if I call function B from another function?
Thanks in advance,
-E.
3 comentarios
Oleg Komarov
el 12 de Abr. de 2011
I don't get this problem. Did you place function B within a if statement inside of function A?
Robert Cumming
el 12 de Abr. de 2011
sounds like function B is not getting called...
Put a break in the code to check that it is (or isn't...)
Elisa
el 12 de Abr. de 2011
Respuestas (2)
Andrew Newell
el 12 de Abr. de 2011
Did you notice an error message? A quote in the middle of a string should be represented by two quotes. Try this:
disp('Now I''m going to call function B')
[k, z] = myfunctionB(3);
Elisa
el 12 de Abr. de 2011
0 votos
1 comentario
Andrew Newell
el 12 de Abr. de 2011
Feel free to accept this answer (just click on the Accept button).
Categorías
Más información sobre Scope Variables and Generate Names en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!