Argument Question?
조회 수: 6 (최근 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개)
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!