필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Imorting data from text file

조회 수: 1 (최근 30일)
Amit
Amit 2013년 7월 23일
마감: MATLAB Answer Bot 2021년 8월 20일
I have some text files with some numeric data in a folder. i want to import the data of each text file in a variable specified by the name of the file for eg. if i am having 3 files named as amit.txt , ankit.txt , anmol.txt , then i want to store the data of amit.txt in a variable amit , data of ankit.txt in the variable ankit and so on ,
what should i do to for this.
Regards, Amit

답변 (1개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 7월 23일
편집: Azzi Abdelmalek 2013년 7월 23일
This is not a good idea, you can save all your data in one cell array
filename={'amit.txt','ankit.txt','anmol.txt'}
for k=1:numel(filename)
data{k}=dlmread(filename{k})
end
% to get file names automatically
folder='E:/Matlab'; % for example
f=dir([folder '/*.txt'])
for k=1:numel(f)
data{k}=dlmread(f(k).name)
end

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by