read table without having reading the directory path
조회 수: 65 (최근 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에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!