function variables not saved to workspace

2 visualizaciones (últimos 30 días)
Qiana Curcuru
Qiana Curcuru el 10 de Mzo. de 2020
Comentada: Star Strider el 14 de Oct. de 2021
Hi,
I define variables in one function and want to pass them off to another function. If I stop the function right before the function ends (at y), x and y are in my workspace, but once the function ends, x and y are gone, and not saved to my workspace.
function [x,y]=myfunc()
x=2;
y=3;
end

Respuesta aceptada

Star Strider
Star Strider el 10 de Mzo. de 2020
Call the function as:
[x,y]=myfunc()
and both should be in your workspace.
  4 comentarios
Andrew Webster
Andrew Webster el 14 de Oct. de 2021
Thank you SOOOOO much. save me an hour headache
Star Strider
Star Strider el 14 de Oct. de 2021
@Andrew Webster — My pleasure!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by