필터 지우기
필터 지우기

Info

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

help with a simple error

조회 수: 2 (최근 30일)
John
John 2012년 2월 19일
마감: 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. The file names are matrix1.txt, matrix2.txt.....matrix100.txt.
I'm trying to import them all using
C = cell(100,1);
for ii = 1:100
C{ii} = importdata(['matrix' num2str(ii) '.txt']) ;
end
but I'm getting an error
??? Error using ==> importdata at 123
Unable to open file.
would anybody know why?
Sincere thanks

답변 (1개)

Wayne King
Wayne King 2012년 2월 19일
Are these files matrix1.txt, matrix2.txt, etc. located in a folder which is on the MATLAB path?
Use addpath, or pathtool, to add that folder to the MATLAB search path.
  댓글 수: 3
Wayne King
Wayne King 2012년 2월 19일
Hi John, are these just numeric matrices with no text in them?
are you sure that matrix1.txt all the way to matrix100.txt exists in that folder
John
John 2012년 2월 19일
Hi Wayne
Oh my fault, I didn't have exactly 100 files in the folder.
Thank you for spotting that!
John

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by