Thursday, 5 September 2013

make matlab variable in workspace as global

make matlab variable in workspace as global

In the workspace I make a matrix .

Now I can access the variable in script. Like doing Variable(2) will
return 4.
But inside a function like
function y= getvariable(x)
y=Variable(x)
end
I get error
y=getvariable(2)
??? Undefined function or method 'Variable' for input
arguments of type 'double'.
Error in ==> getvariable at 3
y=Variable(x)
So how to make the Variable matrix global so that I can access it through
any function?

No comments:

Post a Comment