Using variables created by one .m file in another
14 次查看(过去 30 天)
显示 更早的评论
Hello all,
I use two .m files. One called "project.m" and another "move_leg.m" which is basically a function. The "project.m" creates a vector qL1 and I can see it in the workspace. Now I want to use this qL1 in my "move_leg.m" file. Is there any way to access it other than passing it as a argument. I don't want to pass it as a argument because I already have a lot as arguments for the same "move_leg" function.
Here you can see that qL1 is created.
0 个评论
采纳的回答
Jeffrey Girard
2015-4-8
编辑:Jeffrey Girard
2015-4-8
For example, on project.m put the following:
global qL1;
qL1 = [-pi/2 -pi/2 0];
And on move_leg.m put the following:
global qL1;
You are now ready to use qL1 on move_leg.m
2 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!