Why do I get error when using a simple global variable?
3 次查看(过去 30 天)
显示 更早的评论
I get error and it says ''Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters''
global a b t E nu
GP1=(-a/(sqrt(3),-b/(sqrt(3))
GP2=(a/(sqrt(3),-b/(sqrt(3))
GP3=(a/(sqrt(3),b/(sqrt(3))
GP4=(-a/(sqrt(3),b/(sqrt(3))
0 个评论
回答(1 个)
Chunru
2022-9-27
Not sure what the code is trying to do. However, the error is due to the wrong usage of ( ) rather than global variables.
global a b t E nu
a=1; b=2; t=3; nu=4;
GP1=[-a/sqrt(3),-b/sqrt(3)]
GP2=[a/sqrt(3),-b/sqrt(3)]
GP3=[a/sqrt(3),b/sqrt(3)]
GP4=[-a/sqrt(3),b/sqrt(3)]
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!