How do I do this? Pass a filename to a function?
조회 수: 9 (최근 30일)
이전 댓글 표시
I have created a function to browse a file in a gui. Now I have another function which does some calculations with the variables in the browsed file. So how do I load that file's contents in the new function?
댓글 수: 0
채택된 답변
Image Analyst
2018년 7월 1일
In your first function you pass the filename to the new function:
results = new_function(filename);
Then in new_function you read in the data and do something with it.
function results = new_function(filename)
data = importdata(filename); % of xlsread() or csvread() or readtable() or whatever...
% Now do something with data....
댓글 수: 5
Image Analyst
2018년 7월 2일
Stuart has an excellent collection of them here:
two of which are the second and fourth links on Stephen's list.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Environment and Settings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!