Loading files from the folder
조회 수: 17 (최근 30일)
이전 댓글 표시
Hello,
I have this code which allows the user to select any folder on the computer and then loads all the .mat files to the directory.
%% Data Acuisition from the folder%%%
pathname = uigetdir;
allfiles = dir(fullfile(pathname,'*.mat'));
out = load(allfiles(1).name);
% load all files in a struct so they can accessed later on
for k = 2: numel(allfiles)
out(k) = load(allfiles(k).name);
end
I want to make changes to it such that, user is able to select some files from the folder and not all of them to be loaded to matlab directory..
Does any one know how can we do it ?
댓글 수: 0
채택된 답변
Geoff Hayes
2020년 1월 24일
편집: Geoff Hayes
2020년 1월 24일
hamzah - could you use uigetfile and allow the user to select the files that they are interested in?
[file,path] = uigetfile('*.mat',...
'Select One or More Files', ...
'MultiSelect', 'on');
댓글 수: 7
Geoff Hayes
2020년 1월 27일
I don't undertstand the purpose of including the uigetfile in the signature
function [out] = DataLoading(uigetfile)
This input parameter is unnecessary.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 File Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!