How to call global function?

조회 수: 2 (최근 30일)
Pramit Biswas
Pramit Biswas 2013년 7월 15일
I want to use all variables used in function workspace, in Base Workspace and vice-versa. That can be possible using script(with certain limit that we can't pass argument)
Is it possible to get all feature of script(mainly working with base workspace variable) in function(mainly argument passing)?

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 7월 15일
You can use global function
  댓글 수: 3
Azzi Abdelmalek
Azzi Abdelmalek 2013년 7월 16일
In the workspace type
global x y z % x,y z are your variables
% do the same thing inside your functions
function b=fcn(a)
global x y z
Jan
Jan 2013년 7월 18일
@Pramit: Please consider, that global variables are one of the most hated bad programming patterns, In growing programs they increase the complexity such that debugging can become impossible.
Passing input and output arguments would be much smarter. Why don't you want / aren't you able to pass arguments?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by