|
You can achieve this - but unless you have a very special reason to need to do this, you should not attempt it as it leads to programs that are likely to have bugs, and which cannot easily be maintained.
A much better idea is to pass the value of x into the other function as an argument, and get back any computed value as a result. This is almost always all you need.
If you do need a more sophisticated way to transfer information, look at using Matlab's object-oriented structures. Then x can be an instance variable of a class, and methods of the class can all access it.
You may have heard of global variables. My strong advice is never to use them. If you think you need them, try reanalysing your problem first.
|