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!