I have an image database as 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 open each folder (from 001 to 106) and take the data and save it to a db.mat file
here is my prog :
clear all;clc;cd D:\001\FT-2BU\FT-2BUs = '';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; endendend
Best Answer