Upload every n file to matlab
1 次查看(过去 30 天)
显示 更早的评论
Hello all,
I have the following script that I use to upload text files to Matlab, I want to edit it so I can skip 10 files when uploading, i.e select the 1st file, skip 10 select the 2nd, etc. so I will end up with (1, 11, 21, 31) for example. is there a way that I can do that in Matlab?
Thank you, appreciate it.
[file_list, path_n] = uigetfile('.txt', 'Multiselect', 'on');
filesSorted = natsortfiles(file_list);
if iscell(filesSorted) == 0;
filesSorted = (filesSorted);
end
for i = 1:length(filesSorted);
filename = filesSorted{i};
data = load([path_n filename]);
x = data (:,1);
y = data (:,2);
end
0 个评论
采纳的回答
KSSV
2021-6-18
[file_list, path_n] = uigetfile('.txt', 'Multiselect', 'on');
filesSorted = natsortfiles(file_list);
if iscell(filesSorted) == 0;
filesSorted = (filesSorted);
end
for i = 1:10:length(filesSorted); %<-- change loop index here
filename = filesSorted{i};
data = load([path_n filename]);
x = data (:,1);
y = data (:,2);
end
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Text Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!