You need to declare x
as a global variable in every scope (i.e. function/workspace) that you want it to be shared across. So, you need to write test1
as:
function test1()
global x;
x = 5;
end
More Related Contents:
- globals and parfor
- How to interpolate with MATLAB 3D usind scatteredinterpolant plot? [closed]
- Matlab how to save a modified image from axes [closed]
- how to get a single feature vector from SIFT descriptor [closed]
- Is it possible to define more than one function per file in MATLAB, and access them from outside that file?
- How to get all files under a specific directory in MATLAB?
- Matlab: Running an m-file from command-line
- Loop through files in a folder in matlab
- Hash tables in MATLAB
- Find given row in a matrix
- Use a vector as an index to a matrix
- Suppressing a function’s command window output
- Run Length Encoding in Matlab
- MATLAB: Is it possible to have two event values whilst using ode45?
- MATLAB: Is it possible to overload operators on native constructs (cells, structs, etc)?
- Printing a MATLAB plot in exact dimensions on paper
- Deleting matrix elements by = [] vs reassigning matrix
- Retraining after Cross Validation with libsvm
- Proper way to add noise to signal
- fast 2dimensional histograming in matlab
- Matlab file name with zero-padded numbers
- How can I sort a 2-D array in MATLAB with respect to one column?
- Attempt to execute script as a function
- MATLAB: Differences between .mat versions
- MatLab error: cannot open with static TLS
- Iterating through struct fieldnames in MATLAB
- Save Matlab invisible plot under terminal as an image with same size
- Using OpenGL in Matlab to get depth buffer
- Corner Cases, Unexpected and Unusual MATLAB [closed]
- How to work with Unix timestamps in Matlab?