How to get global variables recognized in main and in functions at the bottom
Show older comments
I have a homework file that says "place global variables here" at the top and then "algorithm here" below that in a for loop and then I can put any helper functions at the bottom.
So I want my helper functions to see those static variables at the top.
But they don't. I have to copy and paste into the function bodies. This is so redundant and silly.
What is a work around? I am not sure I am allowed to put static variables in another file like I did with my functions I am reusing from a previous homework I made a class file and class encapsulating those functions as class methods.
1 Comment
Jan
on 18 Feb 2022
Please post a relevant part of the code, which reproduces the problem. "But they don't" is not precise enough to understand, what happens.
Accepted Answer
More Answers (0)
Categories
Find more on Scope Variables and Generate Names in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!