Question
clc; clear all; close all; A_folder = dir('E:\Notes\SEM 7\PRML\Alphabet Database\A\*.png'); B_folder = dir('E:\Notes\SEM 7\PRML\Alphabet Database\B\*.png'); C_folder = dir('E:\Notes\SEM 7\PRML\Alphabet Database\C\*.png'); D_folder = dir('E:\Notes\SEM 7\PRML\Alphabet Database\D\*.png'); E_folder = dir('E:\Notes\SEM 7\PRML\Alphabet Database\E\*.png'); A_result=cellmat(1,length(A_folder),32,32); B_result=cellmat(1,length(B_folder),32,32); C_result=cellmat(1,length(C_folder),32,32); D_result=cellmat(1,length(D_folder),32,32); E_result=cellmat(1,length(E_folder),32,32); m=100; for i=1:m A_result(1,i)=imread(strcat('E:\Notes\SEM 7\PRML\Alphabet Database\A\',A_folder(i).name)); B_result(1,i)=imread(strcat('E:\Notes\SEM 7\PRML\Alphabet Database\B\',B_folder(i).name)); C_result(1,i)=imread(strcat('E:\Notes\SEM 7\PRML\Alphabet Database\C\',C_folder(i).name)); D_result(1,i)=imread(strcat('E:\Notes\SEM 7\PRML\Alphabet Database\D\',D_folder(i).name)); E_result(1,i)=imread(strcat('E:\Notes\SEM 7\PRML\Alphabet Database\E\',E_folder(i).name)); end My database contains 100 greyscale images. I need to convert them into matrices with each cell containing a matrice of uint8 form of each image.
Expert Answer
John Williams
PhD Expert
Answered Aug 11, 2026
Access Data in Cell Array.
In the above code, index the Cell Array with with Curly Braces, {} & not Smooth Parentheses, () in the for loop ie., change the code in the for loop to:
for i=1:m
A_result{1,i}=imread(strcat('E:\Notes\SEM 7\PRML\Alphabet Database\A\',A_folder(i).name));
B_result{1,i}=imread(strcat('E:\Notes\SEM 7\PRML\Alphabet Database\B\',B_folder(i).name));
C_result{1,i}=imread(strcat('E:\Notes\SEM 7\PRML\Alphabet Database\C\',C_folder(i).name));
D_result{1,i}=imread(strcat('E:\Notes\SEM 7\PRML\Alphabet Database\D\',D_folder(i).name));
E_result{1,i}=imread(strcat('E:\Notes\SEM 7\PRML\Alphabet Database\E\',E_folder(i).name));
end
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related deep learning Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →