Filter löschen
Filter löschen

how to process multiple video files from a folder

6 Ansichten (letzte 30 Tage)
Life is Wonderful
Life is Wonderful am 21 Aug. 2023
I am in the process of processing numerous video files from a folder, so I need a sample support for processing one video file at a time. I am using the following snippet, but I am getting stuck with the following additional parameter when I look at the file name, which is halting my progress. Any assistance would be greatly appreciated.
folder = 'C:\Video_file\';
files = dir(folder)
files = 0×1 empty struct array with fields: name folder date bytes isdir datenum
Error using numel
Not enough input arguments.
ans =
162 % on my windows system
I see followig output
ans =
'.' % this is NOT required
ans =
'..' % this is NOT required
ans =
ans =
Thank you very much.
  4 Kommentare
Stephen23 am 21 Aug. 2023
Bearbeitet: Stephen23 am 21 Aug. 2023
numel( % this will throw an error if S has zero/multiple elements.
"I want to loop through the files one by one"
You can simply loop over the elements of S:
S = dir(..);
for k = 1:numel(S)
F = fullfile(S(k).folder,S(k).name);
% do whatever you want with filename F
Life is Wonderful
Life is Wonderful am 22 Aug. 2023
Thank you very @Stephen23
I could implement my solution.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

C B am 21 Aug. 2023
files = dir('C:\Video_file\*.avi')

Image Analyst
Image Analyst am 21 Aug. 2023
This is one of the most common FAQ questions, so see the FAQ:


Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by