global variable not always global
2 次查看(过去 30 天)
显示 更早的评论
I am relatively new to Matlab. Sometimes when I declare a variable as global its value does not carry to all functions. I list the variable in the 'global' section at the top of each function. I see the variable in the global section of each function, but the code does not see it that way. When I highlight that variable all other instances of it are highlighted in the function. But the same variable is not highlighted in other functions. It is not incorrect spelling or capitalization - I have copied and pasted. I know I have sometimes I declared a variable global more than once in a function and then deleted the duplicates.
My question is once I've made this mess how do I correct it so the code works.
Thanks for your help with the elementary question.
Jim
3 个评论
Walter Roberson
2011-9-22
I would not expect the MATLAB editor to highlight copies of the variable in other functions.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Software Development Tools 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!