How do you allow a user to input a .csv file?
古いコメントを表示
What command is used to allow a user to input a .csv file, also how is the command formatted? Many thanks!
2 件のコメント
KL
2017 年 10 月 15 日
what do you mean by "allow a user"? do you want to have a gui dialog box?
Rochollywood
2017 年 10 月 15 日
回答 (1 件)
If you want to import data from this file,
data = csvread('yourfilename.csv')
if you want user to pick the file using a dialog box, then
[fileName, pathName] = uigetfile('*.csv');
data = csvread(fullfile(pathName,fileName)) ;
4 件のコメント
Rochollywood
2017 年 10 月 15 日
KL
2017 年 10 月 16 日
That's exactly what the second suggestion does. It lets the user browse through his folders to select a csv file.
Walter Roberson
2017 年 10 月 16 日
Note that we recommend against using a variable named "path", as "path" is the name that MATLAB uses to manage how to find files.
KL
2017 年 10 月 16 日
Thanks for pointing it out Walter, I edited the answer.
カテゴリ
ヘルプ センター および File Exchange で Workspace Variables and MAT Files についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!