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!