MATLAB: How to extract L,a and b from a cell

arraycell

I have 6 images and store it in a cell. I then convert it to LAB space. But how do I get the L, a and b channel from the cell? Here's my code:
clear
imgformat = 'LCC%d.jpg';
for k = 1:6
LCC{k} = imread(sprintf(imgformat, k));
cform = makecform('srgb2lab');
lab_Image{k} = applycform(LCC{k},cform);
end
How am I going to get all the L, a and b channel of those 6 images? How should I use the LChannel = lab_Image(:, :, 1); code when working with cell?
Thanks

Best Answer

No, you made lab_Image a cell , not a regular 3D array . The 3D array is actually INSIDE the cell so you need to pull it out first - at least that is the least confusing and most intuitive way to do it.
theImage = lab_Image{theIndex}; % theIndex can be from 1 to 6
LChannel = theImage(:,:,1);
AChannel = theImage(:,:,2);
BChannel = theImage(:,:,3);