필터 지우기
필터 지우기

Info

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

Importing matrices in text files and creating a structure with 100 entries

조회 수: 1 (최근 30일)
John
John 2012년 2월 14일
마감: MATLAB Answer Bot 2021년 8월 20일
Hello there,
I was hoping that somebody could perhaps help me out with a problem that I have. I'm only learning how to use matlab.
I have 100 4x4 matrices in .txt files in a folder.
How could I import them and create a structure with 100 entries and in each entry there would be one matrix.
The reason I ask is because I'm trying to get the average of these matrices and this post provides a solution if the matrices are in this format.
Thank you for your help
Regards
John

답변 (1개)

Sean de Wolski
Sean de Wolski 2012년 2월 14일
Also note, that if they're all the same size, you could stack them along the third dimension and then take the mean of the first and second dimension which would leave you with each matrice's mean.
  댓글 수: 7
Sean de Wolski
Sean de Wolski 2012년 2월 15일
You're welcome!
Were you able to get it working?
John
John 2012년 2월 15일
Hi again,
Honestly I haven't been able to get it to work
This is the code I'm using
C = cell(100,1);
for ii = 1:100
C{ii} = importdata(['matrix' num2str(ii) '.txt']) ;
end
but I'm getting this error
??? Error using ==> importdata at 123
Unable to open file.
The files are just text files each containing a 4x4 matrix
Could you offer any further suggestions?
Thank you

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by