Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Problem accessing a variable in workspace

1 回表示 (過去 30 日間)
Sampath reddy
Sampath reddy 2012 年 3 月 22 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have generated a variable in a program and want to use the same variable from workspace in other program. I dont want to use it like an argument into a function but just as a variable from work space.
For example: I generated a variable 'a' with valid data in workspace and want to use it in other program for other computations without actually declaring the variable in the later program.
Thankyou!

回答 (2 件)

Jan
Jan 2012 年 3 月 22 日
You could define the variable as global in the baseworkspace and inside the function.
But I recommend to transport variables as function arguments. When your program grows, the global sharing of variables will cause more and more troubles until the program cannot be maintained or expanded any longer.

Sampath reddy
Sampath reddy 2012 年 3 月 22 日
How to declare a variable global in base workspace?
  2 件のコメント
Thomas
Thomas 2012 年 3 月 22 日
doc global
global X Y Z
defines X, Y, and Z as global in scope.
Sampath reddy
Sampath reddy 2012 年 3 月 22 日
Cant global variable be used in jobs and tasks??

この質問は閉じられています。

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by