フィルターのクリア

Assign the file name and path to a variable from a file open window

7 ビュー (過去 30 日間)
Jason Burke
Jason Burke 2021 年 4 月 8 日
回答済み: Jason Burke 2021 年 4 月 8 日
In my code, I open a csv file and then parse the data with importdata. I am trying to find a way to not have to hard code the file name and path of the csv and instead use a dialog box to select the file. I have tried to use uiopen but that will not return the full filename to a var.
Right now I have:
fname = 'C:\path\file.csv';
delim = ',';
indata = importdata(fname, delim);
I'd like to make it easier by assigning fname to a file selected via a file open window. Something like:
fname = opendiag('*.csv');
Where after selecting the file it's full name and path gets assigned to the var which can then be used with importdata.

採用された回答

Jason Burke
Jason Burke 2021 年 4 月 8 日
I found uigetfile.
[file, path] = uigetfile('*.csv');
fname = fullfile(path,file);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop uifigure-Based Apps についてさらに検索

タグ

製品


リリース

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by