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 6616765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:37:22+00:00 2026-05-25T20:37:22+00:00

I am using MATLAB to process image files that are created by a camera

  • 0

I am using MATLAB to process image files that are created by a camera and stored in a directory on Windows. I am trying to incorporate feedback into control of the camera and therefore require MATLAB to process an image every time a new image is created and appears in the directory. I have never created a MATLAB program that runs continuously and waits for an event to occur.

From what I’ve read online it appears my best option is to use a timer object and have the MATLAB program read the contents of the directory repeatedly. Is this a good approach or are there alternative approaches I can implement?

I’m wondering if there is a way the MATLAB program can be “triggered” by the appearance of a file in a directory as opposed to constantly surveying the contents of this directory. I hope there is because as the directory fills up I find that the “dir” command in MATLAB is really slow; slow enough that I may not be able to process images as fast as I require.

As a follow up. Are there any recommendations about how to deploy this program? An idea I like is a simple GUI with a “start” and “stop” button.

Thank you.

  • 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-05-25T20:37:23+00:00Added an answer on May 25, 2026 at 8:37 pm

    You could do the following:

    Create timer object, which will check your directory every 10 seconds:

    t = timer('TimerFcn', @mycallback, 'Period', 10.0, 'ExecutionMode', 'fixedSpacing');
    

    your ‘mycallback’ function should look something like this:

    DIR_TO_READ = 'C:\incoming-files';
    DIR_TO_MOVE_PROCESSED = 'C:\processed-files';
    
    % get list of files.
    file_struct = dir(DIR_TO_READ)
    % remove '.' and '..' directories
    file_struct([file_struct.isdir]) = [];
    for j = 1 : numel(file_struct)
        current_file = file_struct(j).name;
        full_filename = fullfile(DIR_TO_READ, current_file)
    
        % add your processing of the file here
        % e.g.
        bla = imread(full_filename);
    
        % now move the processed file to the processed file folder
        movefile(full_filename, fullfile(DIR_TO_MOVE_PROCESSED, current_file))
    
    end       
    

    Now you need to start the timer object

    start(t);
    

    You can stop the timer object with

    stop(t);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some data generated in MATLAB that I want to process using Perl.
I'm working in Matlab on using blockproc to process through an image and use
I am using MATLAB to process data from files. I am writing a program
Using Matlab, how to generate a net of 3^10 points that are evenly located
I'm trying to connect to MySQL using MATLAB R2009b 64 bit and the mysql.cpp
how can I extract filiform areas on the center of an image using MATLAB
I have some differential equations that I need to solve using MATLAB's ODE solvers.
When using MATLAB's lsqnonlin function, I am trying to give a user-defined Jacobian matrix,
I'm using MATLAB and am calling a function that returns properties of the screen.
I am using MATLAB to paste and caption plots into Microsoft Word. I would

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.