I have around 118 chemical element and I would like to put it in multidimesional array to make it easier for me to choose which one I would like to use. I will attached all the textfile that I would like to put in the array. Thank you in advance!

댓글 수: 2

Could you please specify how you want the elements to be arranged in the multidimensional array and what are the dimensions of the array you want to arrange these elements in?
What do you mean how you want the elements to be arrange in the multidimensional array? The dimension will be 3 dimension I think.

댓글을 달려면 로그인하십시오.

 채택된 답변

KSSV
KSSV 2018년 7월 10일
files = dir('*txt') ; % you are in the folder with text files
N = length(files) ;
names = {files(:).name}' ;
iwant = cell(N,1) ;
for i = 1:N
iwant{i} = importdata(files(i).name) ;
end

댓글 수: 8

Then how am I going to use the value in the file? Thank you.
KSSV
KSSV 2018년 7월 10일
Data of the files is stored in the cell iwant.
so I just write for example iwant(:,:,1) and it will give the value I want? Sorry Im quite new with Matlab.
I'll try to execute the command iwant(2,1) but it just gave me {27x6 double} instead of giving me data inside the file i wanted. What do I need to do if I wanted the data inside the files?
KSSV
KSSV 2018년 7월 10일
27X6 is the data of file.
How am I going to use the number inside the file?
KSSV
KSSV 2018년 7월 11일
All files data is stored in the cell array iwant. You can access the data using iwant{i}

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Chemistry에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by