필터 지우기
필터 지우기

Info

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

how do i write a code that checks the names of my files?

조회 수: 1 (최근 30일)
Kristbjörg Bjarkadóttir
Kristbjörg Bjarkadóttir 2016년 10월 18일
마감: MATLAB Answer Bot 2021년 8월 20일
I have a file that has 3 more others files in the first file for example, Coats and when you go in that file there are 3 files that are named wintercoat1, fallcoat2 and summercoat3. I wanna program that tells me okay there where 3 coats in the coat file. I was trying to get started with: A=dir('coats'); i think i should convert the file now into string so i can use if scentence or something but i dont know how to convert the files into a string please help!!

답변 (2개)

Image Analyst
Image Analyst 2016년 10월 18일
Are you saying that you have "coats" and that it is a text file and inside that text file are strings with the names of other text files? If so, you can use fgetl() to retrieve strings out of a text file. Otherwise, you can use dir() to search for wildcard filenames, and now with R2016b, even search subfolders.

Vincent Scalfani
Vincent Scalfani 2016년 10월 18일
Are you just looking to get a list of the file names in a directory? If so, try this:
files = dir('C:\path')
filenames = {files.name}.'

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by