how to pass parameters to a .m file in matlab command window?
5 次查看(过去 30 天)
显示 更早的评论
I have a .m file which requires some parameter to execute a function in it. I want to execute that .m file through command window. Now how to pass the parameter to that m file..?
采纳的回答
Azzi Abdelmalek
2012-9-12
编辑:Azzi Abdelmalek
2012-9-12
If your parameters are in workspace, your m file will recognize them
If this m file is used many times, I recommand to use a function
4 个评论
Azzi Abdelmalek
2012-9-12
If file1 is your m file name and needs parameters a,b and c
>>a=10;b=12;c=14 %your parameters
>>file1
Azzi Abdelmalek
2012-9-12
编辑:Azzi Abdelmalek
2012-9-12
No; it's not possible. if your m file uses a variable x, you have to affect a value to x
>> x=10
>>file1
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Workspace Variables and MAT Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!