How do I make a user defined function with the input being the file name in a string?
4 ビュー (過去 30 日間)
古いコメントを表示
I want to make a user defined function where the user can just type in the file name as the input. For example, if my file is called 'graphs.csv' and my function is called power, I want to be able to do
power('graphs.csv') and for the function to run. How do I make this as my input?
2 件のコメント
採用された回答
その他の回答 (1 件)
dpb
2018 年 8 月 27 日
The users will probably very quickly get very tired of having to type in a fully-qualified file name.
I'd suggest something more on the lines of
function [returns?]=power
fn=uigetfile;
if fn==0, return, end
% function does whatever with the returned filename following
...
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!