# MATLAB: How can I take a global variable declared in a program, take it in a function, change its value inside the fuction and give it again to the program as global

global variables

Hi! I have the following Problem: I have a variable declared in my program, whose value I want to Change in a function and then return it to the program as global, so that when I call the function again the value stored in there is the one I calculated the last time within the function. If anyone could help me, please…

global myVariable
value = doSomething( value );