read table without having reading the directory path
16 ビュー (過去 30 日間)
古いコメントを表示
hi all, this is a simple question and may seems silly.
Currently my table read used syntax :
data_table = readtable('C:\Users\blabla')
However, if i runat different laptop/pc i need to configure the path again.
Please help to suggest and simple code how to solve this. TQ
0 件のコメント
回答 (2 件)
Mohammad Sami
2021 年 3 月 23 日
You can have the user select the file to process using the function uigetfile
[file,path] = uigetfile();
if isequal(file,0)
disp('User selected Cancel');
data_table = [];
else
data_table = readtable(fullfile(path,file));
end
0 件のコメント
David Ash
2023 年 1 月 5 日
You can just change the current folder in the ui as per the attached image, no need to set current folder in the code.

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!