ExtractBetween: Element 2 of the text contains 1 substrings while the previous elements have 0. All elements must contain the same number of substrings.

6 views (last 30 days)
Error using extractBetween (line 79)
Element 2 of the text contains 1 substrings while the previous elements have 0. All
elements must contain the same number of substrings.
files_in_folder = dir('directory/*.mp4');
{files_in_folder.name}
id = extractBetween({files_in_folder.name}, 'file_', '_');
%an example file name would be file_123_test.mp4
The output of {files_in_folder.name} holds and extra file named '.mp4' with no title, just the file extentions mp4. I checked the directory but ther is no such file called '.mp4'.
  2 Comments
Stephen23
Stephen23 on 16 Aug 2022
Edited: Stephen23 on 16 Aug 2022
" checked the directory but ther is no such file called '.mp4'."
How exactly did you "check" the directory? By unreliably looking at something like MS File Explorer, or reliably using a tool that can actually list all files? If using a reliable tool, please show the command you used and its output.

Sign in to comment.

Answers (0)

Categories

Find more on Environment and Settings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!