Construct Timer using evalin
1 次查看(过去 30 天)
显示 更早的评论
I am working on a gui and I want to make a timer in workspace. I use this command but it occured error:
evalin('base','Timer=timer');
evalin('base',['Timer.Name=' 'Timer01']); It cannot change timer name. Please help me.
0 个评论
采纳的回答
Daniel Shub
2011-7-21
Creating the timer in the base workspace may make sense, if you really want the variable Timer to be there, but it is not likely what you want to do. Timer objects are handle objects and you can create the object in one workspace and then get the object with timerfindall from any workspace.
There is no reason that you need to rename the timer object in the base workspace. You can find the object in your current workspace and rename it there.
Even better would be to rename the timer when you create it
evalin('base','Timer=timer(''Name'', ''Timer01'')');
更多回答(1 个)
Chirag Gupta
2011-7-21
evalin('base','Timer.Name = ''test123''');
You need to escape '
2 个评论
Walter Roberson
2011-7-21
Wouldn't assignin(base, 'Timer.Name', 'test123')
be more straight-forward ?
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Software Development Tools 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!