필터 지우기
필터 지우기

dir function help

조회 수: 4 (최근 30일)
James
James 2011년 8월 6일
Hi
I want to be able to list all the jpg files within a folder called videos. Can anyone explain why my code does not work:
dir('videos/*.jpg)
I get the error videos/*.jpg not found. Please help
  댓글 수: 2
Image Analyst
Image Analyst 2011년 8월 6일
Well you're missing a trailing quote, but that won't give that error. Did you follow the guidelines for the second example of this section of the FAQ: http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
Jan
Jan 2011년 8월 7일
@James: Please post a copy of the complete error message.

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

답변 (3개)

Paulo Silva
Paulo Silva 2011년 8월 6일
perhaps the bar is the other one?
dir('videos\*.jpg)
  댓글 수: 1
Pierre
Pierre 2011년 8월 6일
'/' as file separator should also work on Windows systems too. (At least it does on mine.)

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


Fangjun Jiang
Fangjun Jiang 2011년 8월 6일
dir(['videos',filesep,'*.jpg'])
  댓글 수: 1
Pierre
Pierre 2011년 8월 6일
(Just for convenience issues: fullfile('videos', '*.jpg') is equivalent to your statement and comes in quite handy for deeper stacked directory structures.)

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


Pierre
Pierre 2011년 8월 6일
  • Are you in the right working directory? Check with pwd and/or check whether the results of dir (without any parameters) contains a directory called "videos".
  • If there is no file matching the pattern, this error will appear. You won't simply get an empty result (although I agree this should be the case).
  • Did you eventually forget about the case sensitivity of Linux systems?

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by