由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Computation版 - about global in matlab
相关主题
Quick question: BaoZis are rewared.ft! Strange problem in Matlab!
Matlab的Memory Bug???different type of variable results difference in matlab
请问在windows下可以同时运行两个matlab吗?Matlab commands
Matlab和VC混编时能不能查看mxArray的具体内容?Question about Matlab MEX command
请问Matlab如何使用swap空间Execute file under a UNC path in Matlab
问个matlab debug的问题请教一个MATLAB作图问题
How to save variables in file in MATLAB请问用mcc产生一个可执行文件后怎么运行?
solve two variable nonlinear in matlab新手问路:MATLAB 算积分用什么FUNCTION
相关话题的讨论汇总
话题: global话题: variables话题: my话题: use话题: initilize
进入Computation版参与讨论
1 (共1页)
m**i
发帖数: 724
1
I use the profile commands to track my program, to my surprise I found that
the
line that "global a b c" takes a lot of time.
My a b c are cell arries. Is that the reason? Are there other ways that I can
share some variables among functions (Basically, I just want to initilize a,
b, c at the very beginning of the simulation, and use them later. Will
save/load be better?)
c*******e
发帖数: 8624
2
You can load these variables at the beginning of each program if necessary.
Just write it as a separate function to put all the constansts.

【在 m**i 的大作中提到】
: I use the profile commands to track my program, to my surprise I found that
: the
: line that "global a b c" takes a lot of time.
: My a b c are cell arries. Is that the reason? Are there other ways that I can
: share some variables among functions (Basically, I just want to initilize a,
: b, c at the very beginning of the simulation, and use them later. Will
: save/load be better?)

m**i
发帖数: 724
3
I found I can only load the variables into the base workspace. But I want use
them in a function (which has its own workspace.)

that
can
a,

【在 c*******e 的大作中提到】
: You can load these variables at the beginning of each program if necessary.
: Just write it as a separate function to put all the constansts.

a**a
发帖数: 63
4
It's not a good thing to use global variables. You can always wrap these
"global variables" into a structure, and pass it through different functions

use
necessary.
I
initilize

【在 m**i 的大作中提到】
: I found I can only load the variables into the base workspace. But I want use
: them in a function (which has its own workspace.)
:
: that
: can
: a,

1 (共1页)
进入Computation版参与讨论
相关主题
新手问路:MATLAB 算积分用什么FUNCTION请问Matlab如何使用swap空间
matlab question (about C mex ...)问个matlab debug的问题
问个Matlab的问题How to save variables in file in MATLAB
Matlab一问solve two variable nonlinear in matlab
Quick question: BaoZis are rewared.ft! Strange problem in Matlab!
Matlab的Memory Bug???different type of variable results difference in matlab
请问在windows下可以同时运行两个matlab吗?Matlab commands
Matlab和VC混编时能不能查看mxArray的具体内容?Question about Matlab MEX command
相关话题的讨论汇总
话题: global话题: variables话题: my话题: use话题: initilize