How to copy a video file from an external drive to the current workspace?
2 ビュー (過去 30 日間)
古いコメントを表示
I am working on a script which will loop through a group of large videos that I have on an external drive. In psuedo codo I want to:
loop for all files
copy video to current workspace (to increase reading speed)
open video visually
mark certian frame and time stamps
close video & delete local copy
end loop
I have most of this working except I cannot get the copyfile function to work for me, here is what I have written -- any help would be great
[file,path] = uigetfile('*.avi');
name = join([path,file]); % This is a char
CurrentDirectory = 'C:\Users\username\Desktop\Currently Working On'; % this is a char
copyfile name CurrentDirectory;
%% -- ERROR MESSAGE -- %%
% Error using copyfile
% No matching files named 'C:\Users\username\Desktop\Currently Working On\name' were
% found.
0 件のコメント
採用された回答
Jayant
2023 年 6 月 27 日
What I think is the issue you're experiencing is due to passing the variable "name" as a literal string instead of its value. To fix this, you need to concatenate the value of name with the destination directory. Here's the corrected code:
[file, path] = uigetfile('*.avi');
name = fullfile(path, file); % Create the full file path
CurrentDirectory = 'C:\Users\username\Desktop\Currently Working On';
copyfile(name, CurrentDirectory);
By using the "fullfile" function, you ensure that the file path is constructed correctly, taking into account the operating system's file separator. Then, you pass the "name" variable (which holds the full file path) and the destination directory to the "copyfile" function. You may refer to this fullfile & copyfile documentation.
2 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image Processing and Computer Vision についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!