Save vector to m-file
13 次查看(过去 30 天)
显示 更早的评论
Hi. I have a task where I am to create a file called bestPath.m which in turn should include a vector called bestPath. I have searched the net, but no luck. Thanks in advance.
2 个评论
dpb
2014-10-2
Not a good idea...the resulting variable will alias the function name--altho I suppose that could be the intent??
As for the mechanics of doing so, what's the specific problem?
回答(1 个)
Oleg Komarov
2014-10-2
编辑:Oleg Komarov
2014-10-2
a = rand(10);
matlab.io.saveVariablesToScript('test.m','a')
Check the content of the .m file with
edit test
Calling test from the command line will evaluate a into the workspace.
2 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Testing Frameworks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!