imread() is usually far too complex to store in a real-time system. Many real-time systems do not have space to store more than 10 kilowords or perhaps 32 kilobytes of code.
In computer science, real-time computing (RTC), or reactive computing, is the study of hardware and software systems that are subject to a "real-time constraint"— e.g. operational deadlines from event to system response. Real-time programs must guarantee response within strict time constraints.[1] Often real-time response times are understood to be in the order of milliseconds and sometimes microseconds. In contrast, a non-real-time system is one that cannot guarantee a response time in any situation, even if a fast response is the usual result.
But small memory like that is merely typical, not fundamental. It is possible to do real-time work on large systems, including systems that have file systems, but the operating system and hardware has to be designed for that purpose.
Your use of the word "folder" suggests strongly to me that you are planning to do this work on an MS Windows system, which is a problem: MS Windows is not designed for real-time work. Amongst other things, MS Windows is unable to provide time bounds on disk and file-system operations.
A non-trivial difficulty is that there is quite a difference between a file appearing in a directory, vs the file being ready for processing. (This can be overcome with the co-operation of the program that is creating the files.)
You can read about some of the architectures required for real-time systems here. They are your only hope on operating systems supported by MATLAB these days (SGI IRIX used to be able to do real-time work but it is no longer made and has not been supported by MATLAB for even longer.)