필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Loop for open files / extracting image data and saving them in a matrix file

조회 수: 1 (최근 30일)
Harizi Amira
Harizi Amira 2019년 5월 27일
마감: MATLAB Answer Bot 2021년 8월 20일
I have an image database, in the form of files (106 files and each file contains 48 images)
I want to generate a matrix for the database (db.mat)
I want my program to read each folder (from 001 to 106) and take the data (mydata) and save them all to a db.mat file
here is my program :
clear all;
clc;
cd D:\001\FT-2BU\FT-2BU
s = '';
str1 ='00';
str2 ='0';
for i=1:106
if i<10
s=strcat(str1,i);
bmpFiles = dir('*.bmp');
numfiles = length(bmpFiles);
mydata = cell(1, numfiles);
for k = 1:numfiles
mydata{k} = imread(bmpFiles(k).name);
end
save mydata;
elseif i<100
s=strcat(str2,i);
bmpFiles = dir('*.bmp');
numfiles = length(bmpFiles);
mydata = cell(1, numfiles);
for k = 1:numfiles
mydata{k} = imread(bmpFiles(k).name);
end
save mydata;
else
s=i;
bmpFiles = dir('*.bmp');
numfiles = length(bmpFiles);
mydata = cell(1, numfiles);
for k = 1:numfiles
mydata{k} = imread(bmpFiles(k).name);
end
save mydata;
ffn.PNG
end
end

답변 (0개)

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by