How do i upload all images at once?

조회 수: 1(최근 30일)
Kamyar Mazarei
Kamyar Mazarei 2021년 7월 19일
댓글: Image Analyst 2021년 7월 19일
lets say i have 2 folders called 'test' and 'train' and each one has 2 files 'A' and 'B' which each one has about 1000 images
how do i upload them?
i cant drag them all at once, only can do 1 at a time
thank you
  댓글 수: 4
Matt J
Matt J 2021년 7월 19일
Perhaps the intention is to upload the files to Matlab Drive for the purposes of a Mathworks-hosted workshop?

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2021년 7월 19일
You'd have to zip them up into a single file to do them "all at once".
Otherwise you can do them one-at-a-time using code from the FAQ:
where you use sprintf() to create source and destination files and use copyfile() to do the copying.
  댓글 수: 2
Image Analyst
Image Analyst 2021년 7월 19일
How does zipping the source files on the source disk tell you that you don't have enough space on the destination folder (workshop)? Is that were you told it to create the output zip file? What exactly is a workshop? And, well, if you don't have enough room, then you don't have enough room, so clean up some by moving or deleting files that don't need to be in the destination folder.
"tried to zip each subfolder and do it 4 times but matlab froze and closed itself after 5 min" <== then don't use MATLAB for that. I don't know how you got MATLAB to even try to zip the files, but if it doesn't work, zip it from your operating system (i.e. select files and right click from File Explorer in Windows 10 and say Send to compressed folder).
The one-at-a-time method can work perfectly well with filenames like Covid(1), etc.: (Untested code)
filePattern = fullfile(sourceFolder, 'Covid(*.png');
fileList = dir(filePattern) % A list of all PNG files starting with "Covid(".
% Loop over all the files we found, resizing them and saving the resized
% files to the destination folder.
for k = 1 : length(fileList)
% Get source filename.
sourceFileName = fullfile(fileList(k).folder, fileList(k).name);
% Read the image into memory.
imageArray = imread(sourceFileName);
% Display it
% Resize it to the desired size.
imageArray = imresize(imageArray, [desiredRows, desiredColumns]);
% Save the resized image in the destination folder.
destinationFileName = fullfile(destinationFolder, fileList(k).name);
imageArray(imageArray, destinationFileName);
Note: no braces {} were used, only parentheses ().
You say that you want all images to be in a cell array. That would take up a huge amount of memory and could only be done for a few images. Moreover, there is no reason to put them all into a slow and wastefull cell array. None that I can see. Why do you think you need to do this?

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by