Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8892023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:53:28+00:00 2026-06-14T22:53:28+00:00

is there a command to search for a ‘particular entry inside the files present

  • 0

is there a command to search for a ‘particular entry inside the files present in a folder’ in matlab?
like if i want to search for the word “hello” in all the files present in folder A.

allFiles = dir( 'G:\folder\myfilename' );
allNames = { allFiles.name };

only lets me search for a particular file in a specific folder.:(

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T22:53:29+00:00Added an answer on June 14, 2026 at 10:53 pm

    See this answer to get you a list of all files in a directory.

    Then you can use regexpi to identify any files containing the string 'hello'.

    Or as Peter D points out:

    I found it useful to build in regular expressions into the function.

    if ~isempty(fileList)     
       fileList = cellfun(@(x) fullfile(dirName,x),'UniformOutput',false);
       matchstart =  regexp(fileList, pattern); 
       fileList = fileList(~cellfun(@isempty,  matchstart));
    end 
    

    and change the function signature to

    getAllFiles(dirName, pattern) (also in the 2nd to last line)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there special key bindings for pasting in command mode or search mode in
Is there a command line tool available for converting .plist files to JSON? If
Is there any command available for generating all missing spec files for existing models
Is there a command I can run inside my SQL script so that it
Is there a command in MATLAB that allows me to find all NaN (Not-a-Number)
Is there a way or command to be use to find files using a
I want to search *.cpp files in current directory and want to save the
is there a way to search and replace a string using single unix command
In vim, there is this amazing plugin called command-t, that lets you fuzzy-search through
Is there way to use the Find in Files command for searching all of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.