L. Cinelli
L. Cinelli

Reputation: 17

Matlab use a workspace variable within a function

For some reason I need to use workspace variables within a function. How can I "import" these variables into my function? Thanks

Upvotes: 0

Views: 499

Answers (2)

Edric
Edric

Reputation: 25140

You can use evalin('caller', ...) or evalin('base', ...) to do this, but it is vastly preferable to pass arguments in explicitly.

Upvotes: 1

Texmex
Texmex

Reputation: 61

Either pass the variables by argument or (and only seldom recommended) use global variables

Upvotes: 1

Related Questions