Argument Question?
1 次查看(过去 30 天)
显示 更早的评论
I have a homework assignment that says, "Your function will receive the name of the input file as an argument." I'm just a little confused on what that means. Does it means it will be something along the lines of:
function HW = load('data1.txt')
0 个评论
采纳的回答
Sarah Wait Zaranek
2011-4-29
I think this is what they meant -
In the function file:
function outputVar = myfunction(inputVar)
% write the rest of the program here, using inputVar as you would a string
When you call the function you give it a string:
thisoutput = myfunction('data1.txt')
4 个评论
Sarah Wait Zaranek
2011-4-29
Walter, yes I was doing that for clarity. I will change it to inputvar and outputvar.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Whos 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!